Mega Code Archive

 
Categories / XML / XSLT StyleSheet
 

Number from=section level=multiple count=section item format= a

File: Data.xml <?xml version="1.0"?> <outline>  <section title="US coin denominations">   <item>cent</item>   <item>nickel</item>   <item>dime</item>   <item>quarter</item>   <item>half dollar</item>   <item>dollar</item>  </section> </outline> File: Transform.xslt <?xml version="1.0" encoding="US-ASCII"?> <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|//item">       <xsl:number from="section" level="multiple"         count="section | item" format=" a " />       <xsl:value-of select="@title | text()" />       <xsl:text>&#10;</xsl:text>     </xsl:for-each>     <xsl:text>&#10; </xsl:text>   </xsl:template> </xsl:stylesheet> Output:  a US coin denominations  a cent  b nickel  c dime  d quarter  e half dollar  f dollar