|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Incrementing position in the tree midstream (Part
> -----Original Message-----
> From: Durston, Andrew (AGRE)
>
Hi,
<snip />
> I am basically getting confused in how to count the occurances
> down the chain of siblings (all objecttexts under all objects
> under test-plan).
>
What exactly do you need?
If, while processing an objecttext node (the objecttext matching template or
an encompassing xsl:for-each) you need the number of objecttexts having a
certain content ('.0-1.0'), that would be
count(ancestor::test-plan/object/objecttext[.='.0-1.0'])
for the number of all preceding- or following objecttexts in the document,
this would become
count(preceding::objecttext[.='.0-1.0'])
count(following::objecttext[.='.0-1.0'])
The *-sibling axes return only nodes from the same object parent (my guess
is that this is one of the things causing your confusion?)
xsl:number offers a very interesting and highly configurable alternative...
For all objecttext nodes in the document, no matter what level
<xsl:number count="objecttext[.='.0-1.0']"
format="1. " level="any" />
For all objecttext nodes, starting from the current test-plan (if there are
more than one in the document)
<xsl:number count="objecttext[.='.0-1.0']"
from="test-plan"
format="1. " level="any" />
This should rid you of having to do the counting yourself (in case there are
more than one test-plan in your source document, the XPath needed to feed to
count() will obviously become more complicated..)
Hope this helps!
Cheers,
Andreas
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








