This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Dynamically selecting Attributes


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@informatik.hu-berlin.de             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]