Re: [xsl] generate full xpath name to an attribute?

Subject: Re: [xsl] generate full xpath name to an attribute?
From: Ray Tayek <rtayek@xxxxxxxxx>
Date: Thu, 03 Apr 2003 14:29:32 -0800
At 11:09 AM 4/3/03 +0100, you wrote:

> i get: /input/Nodes/Node/Point3.1415926535897
> what i want is: /input/Nodes/Node/Point@x (i think).

You need to read the text as well as just copying code blindly.
Jeni's code is doing a slightly different problem, the line above the
code you've quoted says

  Once we've outputted the information about the ancestor elements, we
  want to round it off with information about the value of the current
  node:

So Jeni's outputting the value as well as the path, and surely it is
clear enough that it ends with a value-of eslect="."  which you don't
want.

yes, i got the following to work:


        <xsl:template name="foo">
                <xsl:for-each select="ancestor-or-self::*">
                        <xsl:text>/</xsl:text>
                        <xsl:value-of select="name()"/>
                </xsl:for-each>
                        <xsl:text>@</xsl:text>
                <xsl:value-of select="name()"/>
        </xsl:template>

and since i *know* that everything i am interested in is an attribute, i can make progress now.

> and i will still have the subscript problem. as Node can occur multiple times.

But that isn't a problem as that FAQ page and other answers on this list
have posted code to do that.

i will look for them.


thanks for your assustance.

---
ray tayek http://tayek.com/ actively seeking mentoring or telecommuting work
vice chair orange county java users group http://www.ocjug.org/
hate spam? http://samspade.org/ssw/


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread