XML information pipe

Ihre Spezialisten für XML

Banner Werbung

XSLT 1.0 reference

apply-templates

Example 1 | Example 2 | Example 3 | Example 4 | Example 5 | Example 6 | Example 7 | Example 8 | Example 9 | Example 10 |


Example 1:


XML source: <AAA>
   <BBB>10</BBB>
   <BBB>5</BBB>
   <BBB>7</BBB>
</AAA>
XSLT stylesheet: <xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:output
method="text"/>

<xsl:template match="/">
   <xsl:apply-templates select="//BBB"/>
</xsl:template>

<xsl:template match="BBB">
   <xsl:text>BBB[</xsl:text>
   <xsl:value-of select="position()"/>
   <xsl:text>]:</xsl:text>
   <xsl:value-of select="."/>
</xsl:template>

</xsl:stylesheet>
Output: BBB[1]: 10
BBB[2]: 5
BBB[3]: 7
Back