xsl-list
[Top] [All Lists]

RE: [xsl] numbering question

2008-12-23 08:40:13
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(_at_)saxonica(_dot_)com] 
Sent: Wednesday, 24 December 2008 12:49 a.m.
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] 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/



--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>