xsl-list
[Top] [All Lists]

Re: extract xpath locator

2004-08-12 04:40:30
I works!
Thanks a lot for the fast answer.
Sorry it was in the archive.

N. Mazziotta

On Thu, 12 Aug 2004 10:25:27 +0100
David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:


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
________________________________________________________________________

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--




<Prev in Thread] Current Thread [Next in Thread>