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

Re: a nicer total sibling count than this

Subject: Re: a nicer total sibling count than this
From: "Stewart C. Russell" <scruss@xxxxxxxxxxxx>
Date: Wed, 18 Sep 2002 21:55:05 -0400
Re:  a nicer total sibling count than this
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



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.