Download Intermediate XSLT and XPath

Transcript
Intermediate XSLT and XPath - 2. The XPath Syntax and the document model
xml-xpath-1-28
2.9 Union of XPaths
• Union Xpaths combine more than one XPath (and all the resulting nodes are returned).
• A typical example is the default rule which means that the template matches either the root
element (i.e. "/" or just any element),
<xsl:template match="*|/">
<xsl:apply-templates/>
</xsl:template>
• Often this is used to simplify apply-templates or even templates themselves. E.g. the
following rules applies to both "description" and "para" elements.
<xsl:template match="para|description">
<p><xsl:apply-templates/></p>
</xsl:template>
XML
© Daniel. K. Schneider, Webster University Geneva - TECFA, University of Geneva 21/4/09