This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]