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

Re: get the value from a different child

Subject: Re: get the value from a different child
From: Nicola Cubeddu <cubo@xxxxxx>
Date: Thu, 04 May 2000 12:56:17 +0100
select a name for child
When you call the following line:

<xsl:value-of select="BILLING_ATTRIBUTES[NAME=$myName]"/>

you are asking for the value of the element "BILLING_ATTRIBUTES" which is a
child of the currently selected node.

1) There are no "BILLING_ATTRIBUTES" elements anywhere on the tree...
2) The current node is "ATTRIBUTE"
3) The "BILLING_ATTRIBUTE" element in your tree does not have any text()
nodes associated with it.

What you want is something like:

<xsl:value-of select="//BILLING_ATTRIBUTE[NAME=$myName]/VALUE/text()"/>

or, to be more precise:

<xsl:value-of select="../BILLING_ATTRIBUTE[NAME=$myName]/VALUE/text()"/>

(the first asking for a BILLING_ATTRIBUTE element anywhere on the tree, the
second specifically asking for a sibling of the current node).

By the way, if you are using anything other than IE5's XML parser, you can
use the shorthand:

<input type="text" name="{NAME}"
value="{="../BILLING_ATTRIBUTE[NAME=$myName]/VALUE}" />

instead of using <xsl:attribute>

Hope this helps,

Ben
 

The solution:

<xsl:template match="ATTRIBUTE[PERMISSION='1']">
  <TR>
    <TD>
      <xsl:value-of select="NAME"/>
    </TD>
    <TD>
     <INPUT TYPE="TEXT">
        <xsl:attribute name="NAME"><xsl:value-of select="NAME"/></xsl:attribute>
        <xsl:variable name="myName"><xsl:value-of select="NAME"/></xsl:variable>

        <xsl:attribute name="VALUE">
           <xsl:value-of select="/LIST/BILLING_ATTRIBUTE[NAME=$myName]/VALUE">
        </xsl:attribute>
     </INPUT>
 ...

thanks Benn!
ciao
 

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.