Re: [xslt] Creating absolute XPath path to the node - problem with position()
- From: Steve Cheng <elmert ipoline com>
- To: The Gnome XSLT library mailing-list <xslt gnome org>
- Subject: Re: [xslt] Creating absolute XPath path to the node - problem with position()
- Date: Mon, 13 Sep 2004 17:33:34 -0400
On Mon, Sep 13, 2004 at 03:28:50PM +0200, Petr Novak wrote:
> I can generate the path with names of element but there is a trouble with
> position().
> If I try something as (both examples are simplified):
>
> <!-- <xsl:text> tags are not here for lucidity -->
> <xsl:for-each select="ancestor-or-self::*">
> <xsl:value-of select="local-name()"/>
> [<xsl:value-of select="position()"/>]/
> </xsl:for-each>
>
> Then the position() makes 'counter' - it always writes:
> /root[1]/element[2]/subelement[3]/sub[4]
> (It is in the general case: /element1[1]/element2[2]/element3[3]/...)
[...]
Mark Vakoc already explained the reason why this fails;
I have a little suggestion, that I wrote something similar:
see <URL:http://cvs.sourceforge.net/viewcvs.py/docbook2x/docbook2X/xslt/common/messages.xsl?rev=1.14&view=log>
(This code uses "moded" templates rather than xsl:for-each,
so it is actually quite extensible.)
--
Steve Cheng
鄭君博
docbook2X: <URL:http://docbook2x.sourceforge.net/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]