getting attribute with XSLT

Discussion in 'XML' started by George Bina, Sep 22, 2006.

  1. George Bina

    George Bina Guest

    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, Sep 22, 2006
    #1
    1. Advertising

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

    thank's
     
    Oobi Van Doobi, Sep 22, 2006
    #2
    1. Advertising

  3. 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
     
    Joe Kesselman, Sep 22, 2006
    #3
  4. "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
     
    Dimitre Novatchev, Sep 23, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stylus Studio
    Replies:
    0
    Views:
    689
    Stylus Studio
    Aug 3, 2004
  2. Kevin
    Replies:
    4
    Views:
    516
    Kevin Burges
    Aug 4, 2003
  3. Bostonasian
    Replies:
    1
    Views:
    822
    Joris Gillis
    Sep 18, 2005
  4. bprimuslevy
    Replies:
    1
    Views:
    441
    Soren Kuula
    Aug 23, 2006
  5. Stefan_W
    Replies:
    1
    Views:
    8,219
    Stefan_W
    Nov 5, 2008
Loading...

Share This Page