Go Back   Velocity Reviews > Newsgroups > XML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

XML - getting attribute with XSLT

 
Thread Tools Search this Thread
Old 09-22-2006, 08:46 AM   #1
Default Re: getting attribute with XSLT


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




George Bina
  Reply With Quote
Old 09-22-2006, 08:57 AM   #2
Oobi Van Doobi
 
Posts: n/a
Default getting attribute with XSLT

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

thank's
  Reply With Quote
Old 09-22-2006, 01:07 PM   #3
Joe Kesselman
 
Posts: n/a
Default Re: getting attribute with XSLT

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
Old 09-23-2006, 02:10 AM   #4
Dimitre Novatchev
 
Posts: n/a
Default Re: getting attribute with XSLT


"Oobi Van Doobi" <> wrote in message
news:qdMQg.17486$. ..
> 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 Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump