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

RE: number + document

Subject: RE: number + document
From: "Lars Huttar" <lars_huttar@xxxxxxx>
Date: Thu, 19 Jun 2003 14:37:47 -0500
xsl number loop
Thank you for remembering to show us your input documents. :-)
That helps a lot.

As far as I can tell (looking at the spec and at the XSLT Programmer's
Reference), <xsl:number> only counts within a given document,
not across documents. (E.g. in the spec at 7.7 it says
"If no value attribute is specified, then the xsl:number element inserts a number based on the
position of the current node IN THE SOURCE TREE
[emphasis mine].")

If you have multiple documents, it's not clear how XSLT would know
what the document order of nodes in different documents should be.

Here's an idea that would work if you're sure that all documents have a
<chap1> as the only child of <docbody> (i.e. there are no <chap2> or
<chap3> children of <docbody> in any document).

Make the number for the <chap1> elements separately, using the position
of the current <chapmod> in the outer for-each loop.
  <xsl:number level="single" count="chapmod" format="A." />

Then use <xsl:number> to number the parts within the document
in the inner for-each loop:
  <xsl:number level="multiple" count="chap2|chap3" format="1.1"/>

Put the result of each of these in a variable and concatenate them together
in the inner loop.  The result: A, B, B.1, B.1.1, etc.


By the way,
> <xsl:for-each select="//doccontent/chapmod">
do you really want to search the whole document for these?
Instead of using // could you use
  select="/*/doccontent/chapmod"
?  It should be faster.

Lars



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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-2013 All Rights Reserved.