[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: Dynamically selecting Attributes


Subject: RE: Dynamically selecting Attributes
From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 13 Oct 2000 18:58:21 +0200 (MET DST)

Hi Jeff,

> I'm trying to select an attribute dynamically based on another attributes'
> value.  For example, given:
> 
>   <find target="name" />
> 
>   <record id="100" name="something" location="somewhere" />
> 
> I would like to be able to return the value of the attribute in <record>
> that is named by the target attribute in the <find> element - the above
> example would return "something" (since <find>'s target attribute specifies
> "name" whose value in the <record> element is "something")

<xsl:variable name="target" select="find/@target" />
<xsl:value-of select="record/@*[name()=$target]" />

Cheers,
Oliver


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/


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



Current Thread