Subject: Re: [xsl] Numbering new nodes using consecutive integers From: Michael Ludwig <milu71@xxxxxx> Date: Sat, 28 Mar 2009 10:34:38 +0100 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Numbering new nodes using, David Carlisle | Thread | Re: [xsl] Numbering new nodes using, G. Ken Holman |
Re: [xsl] substring after/substring, Vyacheslav Sedov | Date | Re: [xsl] Numbering new nodes using, Michael Ludwig |
Month |