Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > getting attribute with XSLT

Reply
Thread Tools

getting attribute with XSLT

 
 
George Bina
Guest
Posts: n/a
 
      09-22-2006
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


 
Reply With Quote
 
 
 
 
Oobi Van Doobi
Guest
Posts: n/a
 
      09-22-2006
Could someone please tell how I cam get an attribute with XSLT?
for example
<tag myattr="somevalue"/>

thank's
 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      09-22-2006
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
 
Reply With Quote
 
Dimitre Novatchev
Guest
Posts: n/a
 
      09-23-2006

"Oobi Van Doobi" <(E-Mail Removed)> wrote in message
news:qdMQg.17486$(E-Mail Removed). ..
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[XSLT] Select node by attribute with value from an attribute of its self Stefan_W XML 1 11-05-2008 10:50 AM
XSLT Newbie: Attribute Value transformed to Attribute Name bprimuslevy XML 1 08-23-2006 09:56 PM
XSLT: Making attribute to parent attribute Bostonasian XML 1 09-18-2005 07:30 AM
ANN: New low-cost XML Editor, XSLT Editor, XSLT Debugger, DTD/Schema Editor Stylus Studio Java 0 08-03-2004 03:53 PM
XSLT: getting text of a node into an attribute Kevin XML 4 08-04-2003 08:53 PM



Advertisments