[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] better way to get the path to a node?


Subject: Re: [xsl] better way to get the path to a node?
From: Graydon <graydon@xxxxxxxxx>
Date: Sat, 1 Dec 2012 08:48:39 -0500

On Sat, Dec 01, 2012 at 11:28:28AM +0100, Martin Honnen scripsit:
> Graydon wrote:
> >If I want to return the XPath path to a specific node when that node is
> >the context node, is there a better way than:
> >
> ><xsl:sequence
> >select="string-join(ancestor-or-self::*/concat('/',name(),'[',for $x in . return count(preceding-sibling::*[name() eq $x/name()])+1,']'),'')"/>
> >
> >"Better" here means "more efficient"; I'll be using various Saxon 9.*
> >for this, either in oXygen or from java.
> 
> 
> With Saxon there is
> http://www.saxonica.com/documentation/extensions/functions/path.xml.
> I haven't checked exactly however for which versions of Saxon 9.* it
> is available.

Thank you!

I haven't, either, but can burn that bridge on Monday. (and check that
saxon:path() really is faster for the data-set in question than the
above.  I'll be really surprised if it's not.)

-- Graydon


Current Thread
Keywords