December 2002
Intermediate to advanced
576 pages
32h
English
<xsl:if>
You can use the <xsl:if> conditional to
select a specific element while inside a template. The
<xsl:if> element uses the
test attribute to determine whether to include the
contents of an element. The test attribute takes
an expression that tests for a specific element or attribute. For
example:
<xsl:template match="chapter/title"> <xsl:apply-templates/> <xsl:if test="not([last( )])">, </xsl:if> </xsl:template>
This template matches each qualifying
<title> element but inserts commas only
after those that are not the last <title>
element. The result is a standard comma-separated list.
<xsl:if
test="expression">
...
</xsl:if>Read now
Unlock full access