|
Subject: RE: [xsl] Finding last node in recursive tree From: "Woosley, David" <David.Woosley@xxxxxxxx> Date: Thu, 7 Aug 2003 16:05:29 -0400 |
Thanks, but you're missing a key point. The only common ancestor of all
<dataset> nodes is the root node. Look at this diagram ...
report
dataset
dataset
dataset
dataset
dataset
dataset
DATASET
I need to know when I'm starting the 'DATASET' that appears in caps -- the
very last dataset node regardless of depth.
d.
-----Original Message-----
From: Abhijit Junnare [mailto:mavlaabhi@xxxxxxxxx]
Sent: Thursday, August 07, 2003 3:52 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Finding last node in recursive tree
Not sure if I understand you correct but here is what
I think will work.
you can use something like this
<xsl:if test="count(following-sibling::node())=0">
in the template which matches the <dataset> element.
If there are no more dataset elements following the
current dataset element with the same parent thus
meaning in the same nodeset then this will return a
value true else it will be false.
For example in the following context
<stuff>
1 <dataset>
2 <dataset>
<stuff/>
3 <dataset>
<stuff/>
</dataset>
4 <DATASET>
<stuff/>
</dataset>
<stuff/>
</dataset>
</dataset>
</stuff>
Thus this will return a value of TRUE for nodes named
1 2 and 4 while it will return FALSE for 3 since it is
not the last dataset element.
Hope this helps.
Good Luck !
Abhi
Abhijit Junnare
--- "Woosley, David" <David.Woosley@xxxxxxxx> wrote:
> Assume my XML document contains one or MORE
> hierarchies of 'dataset' nodes,
> like this:
>
> <report>
> <stuff/>
> <dataset>
> <dataset>
> <stuff/>
> </dataset>
> <dataset>
> <stuff/>
> </dataset>
> </dataset>
> <stuff/>
> <dataset>
> <dataset>
> <stuff/>
> <dataset>
> <stuff/>
> </dataset>
> <DATASET>
> <stuff/>
> </dataset>
> <stuff/>
> </dataset>
> </dataset>
> <stuff/>
> </report>
>
> The 'dataset' levels will vary in depth. Other
> elements will be sprinkled
> among the 'dataset' nodes. How can I determine when
> I am at the beginning
> of the very LAST 'dataset' node (the node in caps
> above), regardless if its
> depth?
>
> Many thanks,
>
> David Woosley
>
>
>
> XSL-List info and archive:
> http://www.mulberrytech.com/xsl/xsl-list
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Finding last node in recu, Michael Kay | Thread | RE: [xsl] Finding last node in recu, Lars Huttar |
| RE: [xsl] how to process a element , Abhijit Junnare | Date | RE: [xsl] how to process a element , Xia Li |
| Month |