Re: access attribute in the parent element.

Subject: Re: access attribute in the parent element.
From: WCB <WCBorg@xxxxxxxxxxxx>
Date: Tue, 20 Jun 2000 20:06:30 -0700
The abbreviated syntax to refer to the parent node is ".."  [In case
you're interested, the full function is "from-parent(node())"]

To specify the attribute "first" use "@first".  Stringing them together
with a "/" and substituting it in the select statement gives:

    <xsl:template match="COUNTRY">
       <xsl:value-of select="../@first"/>

This returns "john" when I tested it on Cocoon using:

    <NAME first="john" last="mike">

If you want to get the attribute from the root instead, use

<xsl:value-of select="//@first"/>

Hope that helps,

-- Willy

At 06:32 PM 6/20/00 -0700, you wrote:
How can i get the value of an attribute from a parent
element/from an element in the top of the hirarchy.

<NAME first="john" last="mike">

<xsl:templte match "NAME">

<xsl:template match="COUNTRY">
 <xsl:value of select=??, i want value of first>


__________________________________________________ Do You Yahoo!? Send online invitations with Yahoo! Invites.

XSL-List info and archive:

XSL-List info and archive:

Current Thread