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> <section title="Persons on US coins"> <element>Abraham Lincoln (cent)</element> <element>Thomas Jefferson (nickel)</element> <element>Franklin Roosevelt (dime)</element> <element>George Washington (quarter)</element> <element>John Kennedy (half dollar)</element> <element>Sacagawea (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 8. Persons on US coins 9. Abraham Lincoln (cent) 10. Thomas Jefferson (nickel) 11. Franklin Roosevelt (dime) 12. George Washington (quarter) 13. John Kennedy (half dollar) 14. Sacagawea (dollar)