This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: a nicer total sibling count than this
- From: "Stewart C. Russell" <scruss at sympatico dot ca>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 18 Sep 2002 21:55:05 -0400
- Subject: Re: [xsl] a nicer total sibling count than this
- References: <1393EFE308EEB14C8D7B1686614A53DF0163705C@schi104.us.cnare.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Macaulay,Malcolm (US) wrote:
You don't need all the counting stuff. If I understand you correctly,
the test is simply: "is there a preceding def element?".
that's not quite the case. What I'm needing to do is number *all* the defs if there are more than one. F'rinstance, given:
<psp type="n">
<def>physical or mental ...</def>
<def>a condition in which ...</def>
</psp>
I would want:
1 physical or mental ... 2 a condition in which ...
Using the stylesheet including '<xsl:if test="preceding-sibling::def">' gives me
physical or mental ... 2 a condition in which ...
-> the first def isn't getting numbered. Blame the weirdness on dictionary conventions.
Thanks also to Wendell, whose "count(../def) > 1" expression is probably the easiest to understand of all the solutions, and to Dimitre's "preceding-sibling::def or following-sibling::def" solution is very efficient and logical.
Stewart
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list