[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Numbering new nodes using consecutive integers

Subject: Re: Numbering new nodes using consecutive integers
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Fri, 27 Mar 2009 19:05:12 +0100
Re:  Numbering new nodes using consecutive integers
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.