[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Finding last node in recursive tree


Subject: Re: [xsl] Finding last node in recursive tree
From: Abhijit Junnare <mavlaabhi@xxxxxxxxx>
Date: Thu, 7 Aug 2003 12:52:10 -0700 (PDT)

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



Current Thread
Keywords
xml