Re: [xsl] extract xpath locator

Subject: Re: [xsl] extract xpath locator
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 12 Aug 2004 10:25:27 +0100
The archives of this list (and possibly the faq) have a very complete
implementation of this from Dimitre if I recall that handles all kinds
of nodes, comments text etc, but basically you want to use
[<xsl:value-of
select="1+count($node/preceding-sibling::*[local-name(.)=local-name($node)
                                   and namespace-uri(.)= and namespace-uri($node)])"/>]

or simpler don't write out 
<xsl:value-of select="name($node)">
just write out a *
then you can do
[<xsl:value-of
select="1+count($node/preceding-sibling::*)"/>]

ie produce

/*[1]/*[2]

rather than
"/doc/i[2]".


> I have tried to "count(preceding-sibling::$name)"

You can never use a variable to hold a bit of Xpath syntax, this would
be like having x="+ 2" in C and hoping that 1 x was a) legal and b)
evaluated to  3. Variables can only be bound to values.

David


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread