This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: how to select the same attribute form more elements?
- From: "Andrew Welch" <awelch at piper-group dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 14 Feb 2002 15:36:58 -0000
- Subject: RE: [xsl] how to select the same attribute form more elements?
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi,
You could use:
<xsl:template match="/">
<xsl:apply-templates select="myxml/node"/>
</xsl:template>
<xsl:template match="node">
<xsl:value-of select="@val"/>
</xsl:template>
To give you:
1234
I dont think there is a single expression to return all the attributes.
Also, /myxml/node/text() should return only 't1' (as it is the only text in
the first node) and /myxml/node/@val should return the first attribute and
not the last... how are you structuring your stylesheet??
cheers
andrew
-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of
Jakub.Valenta@Deio.net
Sent: Thursday, February 14, 2002 2:49 PM
To: XSL-List@lists.mulberrytech.com
Subject: [xsl] how to select the same attribute form more elements?
Hi all,
what expression should I use to select all val attributes in the following
doc at once:
<myxml>
<node val="1">t1</node>
<node val="2">t2</node>
<node val="3">t3</node>
<node val="4">t4</node>
</myxml>
I can easily get all the values of text nodes by : /myxml/node/text(),
but I don't know how to get all the values of the attributes since:
/myxml/node/@val
gives my just the last one.
br,
Jakub
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list