This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: RE: Postional predicates de-mystified
- From: Dimitre Novatchev <dnovatchev at yahoo dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Fri, 4 Jan 2002 05:29:10 -0800 (PST)
- Subject: [xsl] Re: RE: Postional predicates de-mystified
- Reply-to: xsl-list at lists dot mulberrytech dot com
> > <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