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

RE: select attribute value based on attribute value

Subject: RE: select attribute value based on attribute value
From: "Clapham, Paul" <pclapham@xxxxxxxxxxxxx>
Date: Thu, 15 Mar 2001 15:57:47 -0800
xsl select attribute value
Wouldn't that be more like

<xsl:if test="listOfelements/animal[@att2='frogKEY']"><xsl:value-of
select="../animal/@att1"/></xsl:if>
                                     ^^^^
?

PC2

-----Original Message-----
From: Alex Reuter 

Hello List,
I am trying to select an attribute att1 from an animal,
<listOfelements>
<animal att1="frog" att2="frogKEY">45</animal>
<animal att1="dog" att2="dogKEY">55</animal>
<animal att1="cat" att2="catKEY">33</animal>
<animal att1="mouse" att2="mouseKEY">22</animal>
<listOfelements>

by first checking the value of att2.  So I need to display @att1 when
@att2="frogKEY".
My code currently does the following
<xsl:if test="listOfelements/animal[@='frogKEY']"><xsl:value-of
select="../animal/@att1"/></xsl:if>

Its not working for me, so my code is definately wrong.  Any suggestions
would be appreciated.

My general question is, how do i select the value of an attribute based on
the value of another attribute?
Would it make more sense to move these attributes into sub elements?

Thanks,
Alex

 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.