469,621 Members | 1,760 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,621 developers. It's quick & easy.

getting attribute with XSLT

Could someone please tell how I cam get an attribute with XSLT?
for example
<tag myattr="somevalue"/>

thank's
Sep 22 '06 #1
3 1675
Hi,

What do you mean by "getting attibute"?

If you want the myattr value you can use
<xsl:template match="tag">
<xsl:value-of select="@myattr"/>
</xs;:template>

If you want the attribute itself then you can use xsl:copy-of to copy
that to some element you create in the output, something like:

<xsl:template match="tag">
<newTag><xsl:copy-of select="@myattr"/></newTag>
</xs;:template>

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Oobi Van Doobi wrote:
Could someone please tell how I cam get an attribute with XSLT?
for example
<tag myattr="somevalue"/>

thank's
Sep 22 '06 #2
The attribute:: axis (attribute::myattr), and/or its shorthand
representation @ (@myattr).

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Sep 22 '06 #3

"Oobi Van Doobi" <sk****@dambo.diwrote in message
news:qd******************@reader1.news.jippii.net. ..
Could someone please tell how I cam get an attribute with XSLT?
for example
<tag myattr="somevalue"/>
The best recommendation is that you study XPath -- this is something very
fundamental.

Cheers,
Dimitre Novatchev
Sep 23 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by stephane.mottelet | last post: by
2 posts views Thread by Keith Chadwick | last post: by
1 post views Thread by Marc Scheuner [MVP ADSI] | last post: by
1 post views Thread by arnold | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.