[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: generate full xpath name to an attribute?

Subject: Re: generate full xpath name to an attribute?
From: Ray Tayek <rtayek@xxxxxxxxx>
Date: Mon, 31 Mar 2003 08:33:13 -0800
xpath name
At 04:23 PM 3/31/03 +0100, you wrote:

yikes! - looks like the simplest way is to have:

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

i ended up using a name= on the above and doing a call-template.


depending on your document type this might not give you an unambigous
path back to your attribute

right. i have arrays, so that is another problem :(


 (and you probably want a @ before that last
step)

yes and tried doing that with if's. i found some stuff in the archives about determining whether something is an element or an attribute at http://www.biglist.com/lists/xsl-list/archives/200212/msg00523.html and http://www.biglist.com/lists/xsl-list/archives/200212/msg00518.html


<xsl:if test="../@*/.">
<xsl:if test="../@*">
count(. | ../@*) = count(../@*)

none of these seem to work very well. they tend to generate stuff like: input/Nodes@Node/Point/3.14159265358979

using the first two:
                        <xsl:if test="../@*/.">
                        <xsl:text>@</xsl:text>
                        </xsl:if>
                        <xsl:if test="not(../@*/.)">
                        <xsl:text>/</xsl:text>
                        </xsl:if>

does this: input/Nodes@Node/Point/3.14159265358979

the @ is in the wrong place and the value (pi) instead of the name is coming out.

what i want is input/Nodes/Node/Point/x (i will solve the subscript problem later with number or something i hope).

seems like there should be an easier way to skin this cat :(.

thanks


--- 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.