|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








