[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Numbering new nodes using consecutive integers
David Carlisle schrieb am 27.03.2009 um 21:58:30 (+0000): > > perhaps this is less wrong. > <xsl:template match="Groups"> > <xsl:copy> > <xsl:apply-templates > select="G1/M[ position() mod $M-per-G2 = 1 ]" mode="group"/> > </xsl:copy> > </xsl:template> > > <xsl:template match="M" mode="group"> > <G2 no="{position()}"><!-- I want this GR to be numbered sequentially. --> > <xsl:copy-of select=" > . | following-sibling::M[position() < $M-per-G2]"/> > </G2> > </xsl:template> Simply perfect. Thanks! The lesson might be: Knowing that position() will be the device to do the numbering (and not <xsl:number/>), the task is in setting up a suitable current context, which implies the required numbering. This context happily (and necessarily, in this case) coincides with what I need to introduce a new hiararchical level <G2>. By applying templates from <G1>, I had moved too close to the problem and lost the occasion to solve it easily. Thanks for reframing this! Michael Ludwig
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! 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
|