xsl-list
[Top] [All Lists]

Re: [xsl] Numbering new nodes using consecutive integers

2009-03-27 14:06:29
G. Ken Holman schrieb:
<xsl:number> should be used for adding text to the result tree and
only used in variables as a last resort.

I think I may have heard that last week ... :-)

Now it would be perfect if the numbering was done as a strict
sequence of consecutive integers, meaning 1,2,3 instead of, say,
1,3,5.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="2.0">

        <xsl:attribute name="no"
               select="position() (:within this group:) +
                       (:count of subgroups within previous groups:)
                       sum( for $g1 in ../preceding-sibling::G1 return
                            ((count($g1/M)-1) idiv $M-per-G2 + 1) )"/>

Perfect! Thanks!

(I made a note to remember using XPath 2.0 comments to make complex
expressions less cryptic.)

Michael Ludwig

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--