Example: Generating a Custom Error Message
Using a commit script, write a custom error message that appears when the
descriptionstatement is not included at the[edit interfaces t1-fpc/pic/port]hierarchy level:<?xml version="1.0" standalone="yes"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:junos="http://xml.juniper.net/junos/*/junos"xmlns:xnm="http://xml.juniper.net/xnm/1.1/xnm"xmlns:jcs="http://xml.juniper.net/junos/commit-scripts/1.0"><xsl:import href="../import/junos.xsl"/><xsl:template match="configuration"><xsl:variable name="interface" select="interfaces/interface"/><xsl:for-each select="$interface[starts-with(name, 't1-')]"><xsl:variable name="ifname" select="."/><xsl:if test="not(description)"><xnm:error><xsl:call-template name="jcs:edit-path"/><xsl:call-template name="jcs:statement"/><message>Missing a description for this T1 interface.</message></xnm:error></xsl:if></xsl:for-each></xsl:template></xsl:stylesheet>