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

RE: numbering question

Subject: RE: numbering question
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Date: Wed, 24 Dec 2008 02:39:42 +1300
RE:  numbering question
Thanks Michael

 - "For each countable node (taking them in document order), count how many
preceding siblings it has that also match the count pattern and add one for
the node itself."

I had misread this, thinking that the "sibling" relation was applied _after_
removing any nodes (at any level) that didn't match the count pattern. I'm
glad to have that corrected at last.

But I think I have the right expression for my problem here:

  count="/document | included | section[not(parent::included)]"

gives me exactly the right numbers everywhere.

This works because a "document" node will never appear anywhere except
directly under an "included" node or at the document root. But I was just
playing around with this expression to see how I would express the count if
it was, and found that

  count="/document | included | (section|document)[not(parent::included)]"

is invalid. Is there a more concise way of writing this expression than the
full version below?

  count="/document | included | section[not(parent::included)] |
document[not(parent::included)]"


Cheers
Trevor


-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx] 
Sent: Wednesday, 24 December 2008 12:49 a.m.
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  numbering question

Each 2nd-level <document> element is the first child of its parent, and
therefore gets the number 1.

Try count="/document | included | section"

(Or just generate the leading "1." by hand, as it's constant, and use
count="included | section").

Michael Kay
http://www.saxonica.com/

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