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

RE: Finding last node in recursive tree

Subject: RE: Finding last node in recursive tree
From: "Woosley, David" <David.Woosley@xxxxxxxx>
Date: Thu, 7 Aug 2003 16:05:29 -0400
david woosley
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:  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

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.