<xsl:value-of select="/elem1/property[(_at_)name='name1']/@value"/>
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
Michael Thomas <thomas(_at_)hep(_dot_)caltech(_dot_)edu>
04/07/2005 02:10 PM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
cc
Subject
[xsl] attribute selection
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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--