Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Getting attributes

Hi,
How do I return the value of an attribute. I tried <xsl:value-of
select="Root/Attrib"/>, but it doesn't work.
Thanks in advance,
-Fobold
[182 byte] By [Fobold] at [2007-11-9 14:54:33]
# 1 Re: Getting attributes
They should be prefaced with a @ in the xsl select parameter. Or one can
use an attribute template {Attrib}, but only with MSXML3 (maybe other
parsers, I only know MS)

Greg Longtin

"Fobold" <fobold@hotmail.com> wrote in message
news:38ec6ef0@news.dev-archive.com...
> Hi,
>
> How do I return the value of an attribute. I tried <xsl:value-of
> select="Root/Attrib"/>, but it doesn't work.
>
> Thanks in advance,
>
> -Fobold
Greg Longtin at 2007-11-11 23:34:01 >
# 2 Re: Getting attributes
"Fobold" <fobold@hotmail.com> wrote:
>Hi,
>
> How do I return the value of an attribute. I tried <xsl:value-of
>select="Root/Attrib"/>, but it doesn't work.
>
> Thanks in advance,
>
> -Fobold
>
>You can use this
<xsl:value-of select"TITLE@Name">, where title is the tag name and Name is
its attribute
Mukesh Shetty at 2007-11-11 23:34:56 >
# 3 Re: Getting attributes
suppose your XML is

<nodes>
<node value="test"/>
</nodes>

this is how you can get the value of the attribute

<xsl:template match="nodes">
<xsl:value-of select="node/@value"/>
</xsl:template>

Microsoft actually has a really nice XSL pattern
guide written...

--
Patrick Escarcega patrick AT vbguru DOT net
Consultant:Maxim Group www.vbguru.net
---Do not write below this line-----
"Fobold" <fobold@hotmail.com> wrote in message
news:38ec6ef0@news.dev-archive.com...
> Hi,
>
> How do I return the value of an attribute. I tried <xsl:value-of
> select="Root/Attrib"/>, but it doesn't work.
>
> Thanks in advance,
>
> -Fobold
>
>
Patrick Escarcega at 2007-11-11 23:36:05 >