getting attribute with XSLT

G

George Bina

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
 
O

Oobi Van Doobi

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

thank's
 
J

Joe Kesselman

The attribute:: axis (attribute::myattr), and/or its shorthand
representation @ (@myattr).
 
D

Dimitre Novatchev

Oobi Van Doobi said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,005
Messages
2,570,264
Members
46,859
Latest member
HeidiAtkin

Latest Threads

Top