[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
RE: attribute selection
Subject: RE: attribute selection
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Thu, 07 Apr 2005 19:19:12 +0000
|
do:
<xsl:value-of select = "elem1/property[@name='name1']/@value"/>
HTH
Vasu
From: Michael Thomas <thomas@xxxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: attribute selection
Date: Thu, 07 Apr 2005 12:10:08 -0700
I have an xml fragment such as:
<elem1>
<property name="name1" value="value1" />
<property name="name2" value="value2" />
</elem1>
...with many such property elements inside the elem1 element.
I want to print the value of the 'value' attribute for the property element
that has a name of 'name1'. So far I've been doing it this way:
<xsl:for-each select="./elem1/property[./@name='name1']">
<b><xsl:value-of select="@value"/></b>
</xsl:for-each>
But it seems like there should be a more concise way of doing this,
especially since I know that my input document will only have one property
element with a matching "@name='name1'" attribute.
--Mike
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|