[Contents] [Prev] [Next] [Index] [Report an Error]

<xsl:if test="xpath-expression">

An <xsl:if> programming instruction is a conditional construct that causes instructions to be processed if the XPath expression held in the test attribute evaluates to true.

<xsl:if test="xpath-expression">
</xsl:if>

Table 9: Programming Instructions: Examples and Pseudocode

Programming Instruction Examples

Pseudocode Meanings

<xsl:choose>
<xsl:when test="system/host-name">
     <change>
          <system>
               <host-name>M320</host-name>
          </system>
     </change>
</xsl:when>
<xsl:otherwise>
     <xnm:error>
          <message>Missing [edit system host-name] M320.</message>
     </xnm:error>
</xsl:otherwise>
</xsl:choose>

When the host-name statement is included at the [edit system] hierarchy level, change the hostname to M320.

Otherwise, issue the warning message: Missing [edit system host-name] M320.

<xsl:for-each select="interfaces/interface[starts-with(name, 'ge-')]/unit">

For each Gigabit Ethernet interface configured at the [edit interfaces ge-fpc/pic/port unit logical-unit-number] hierarchy level.

<xsl:for-each select="data[not(value)]/name">

Select any macro parameter that does not contain a parameter value.

In other words, match all apply-macro statements of the following form:

apply-macro apply-macro-name {
parameter-name;
}

And ignore all apply-macro statements of the form:

apply-macro apply-macro-name {
parameter-name parameter-value;
}
<xsl:if test="not(system/host-name)">

If the host-name statement is not included at the [edit system] hierarchy level.

<xsl:if test="apply-macro[name = 'no-igp']

If the apply-macro statement named no-igp is included at the current hierarchy level.

<xsl:if test="not(../apply-macro[name = 'no-ldp'])

If the apply-macro statement with the name no-ldp is not included two hierarchy levels above the current hierarchy level.


[Contents] [Prev] [Next] [Index] [Report an Error]