This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]