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

Re: RE: Postional predicates de-mystified

Subject: Re: RE: Postional predicates de-mystified
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Fri, 4 Jan 2002 05:29:10 -0800 (PST)
 Re: RE: Postional predicates de-mystified
> > <xsl:value-of select=" for $i in 1 to count(ancestor::*)
> >    return name((ancestor::*)[$i])" separator = "/"/> 
> >
> > Provides the 'path' to the current node! Pretty neat.
> > (or should I be saying a document order sequence?)
> 
> I think Dave was trying out the numeric predicates, but more neatly,
> you could just use:
> 
>   <xsl:value-of select="for $e in ancestor::* return name($e)"
>                 separator="/" />

This is indeed quite powerful, however in order to obtain the "path" to the current
node there still must be:

 1. The starting "/" for the root node. This could be obtained by changing the
expression to:

   <xsl:value-of select="for $e in ancestor::node() return name($e)"
                 separator="/" />

 2. The path has to include the current node. Therefore something like this will be
required:

   <xsl:value-of select="for $e in ancestor-or-self::node() return name($e)"
                 separator="/" />

  but this will not work for non-element nodes...

 3. Most important, positional information will not be included, so for example:

  /a/b[2]/c[3]

will produce:

 /a/b/c

 4. Maybe I'm wrong, but shouldn't this be: separator="'/'" ?


Cheers,
Dimitre Novatchev.




__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

 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.