File: Data.xml
<?xml version="1.0"?>
<outline>
<section title="US coin denominations">
<element>cent</element>
<element>nickel</element>
<element>dime</element>
<element>quarter</element>
<element>half dollar</element>
<element>dollar</element>
</section>
</outline>
File: Transform.xslt
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="outline">
<xsl:for-each select="section|//element">
<xsl:number level="any" count="section | element" format="1. " />
<xsl:value-of select="@title | text()" />
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Output:
1. US coin denominations
2. cent
3. nickel
4. dime
5. quarter
6. half dollar
7. dollar
|