|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Numbering in a hierarchy
> or is it better to use saxon:assign for that? It's never better to use saxon:assign, assigning to variable references in this way completely breaks the processing model of xslt. > My initial approach was to simply use <xsl:number/> what was wrong with that approach? It would seem that you just want xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="*"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="group"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:attribute name="number"><xsl:number/></xsl:attribute> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="item"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:attribute name="number"><xsl:number count="group|item" level="multiple" format="1-1" /></xsl:attribute> <xsl:apply-templates/> </xsl:copy> </xsl:template> </xsl:stylesheet> $ saxon num.xml num.xsl <?xml version="1.0" encoding="utf-8"?><top> <group number="1"> <item number="1-1">test</item> <item number="1-2">test</item> <item number="1-3">test</item> <item number="1-4">test</item> </group> <group number="2"> <item number="2-1">test</item> <otheritem>test</otheritem> <item number="2-2">test</item> <item number="2-3">test</item> <item number="2-4">test</item> </group> </top> ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
|
Back To School Sale!Save 30% off all Stylus Studio 2008 Products when you purchase from our Online Shop. Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






