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

RE: Incrementing position in the tree midstream (Part

Subject: RE: 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
number tree
> -----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

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.