|
Subject: RE: [xsl] Incrementing position in the tree midstream (Part 2) From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx> Date: Thu, 15 Apr 2004 20:37:01 +0200 |
> -----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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Incrementing position in the , Durston, Andrew (AGR | Thread | [xsl] Context Assignment Question a, Blaine Garrett |
| [xsl] Context Assignment Question a, Blaine Garrett | Date | RE: [xsl] how do you determine if a, Wendell Piez |
| Month |