adding alt tags

Discussion in 'XML' started by N9, Apr 30, 2008.

  1. N9

    N9 Guest

    Hi,

    <xsl:template match="Field[@Name='Image']">

    <xsl:copy-of select="img"/>
    <xsl:copy-of select="a"/>

    </xsl:template>

    Tht ouput is:

    <img src="/files/teaser billeder/basillikum.jpg" style="" />

    But can i adding a attribute, so the result is?

    <img src="/files/teaser billeder/basillikum.jpg" style="" alt=""/>

    Best regards

    N9
    N9, Apr 30, 2008
    #1
    1. Advertising

  2. N9 wrote:

    > <xsl:template match="Field[@Name='Image']">
    >
    > <xsl:copy-of select="img"/>
    > <xsl:copy-of select="a"/>
    >
    > </xsl:template>
    >
    > Tht ouput is:
    >
    > <img src="/files/teaser billeder/basillikum.jpg" style="" />
    >
    > But can i adding a attribute, so the result is?
    >
    > <img src="/files/teaser billeder/basillikum.jpg" style="" alt=""/>


    You can add an attribute to the img element but not if you use
    xsl:copy-of. Use
    <xsl:template match="Field[@Name='Image']">
    <xsl:apply-templates select="img"/>
    <xsl:copy-of select="a"/>
    </xsl:template>

    <xsl:template match-"Field/img">
    <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:attribute name="alt"></xsl:attribute>
    </xsl:copy>
    </xsl:template>






    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Apr 30, 2008
    #2
    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. Dean H. Saxe
    Replies:
    0
    Views:
    1,030
    Dean H. Saxe
    Jan 3, 2004
  2. Rob Nicholson
    Replies:
    3
    Views:
    727
    Rob Nicholson
    May 28, 2005
  3. Luigi Donatello Asero

    Alt-text Tags and D-links

    Luigi Donatello Asero, Jul 4, 2004, in forum: HTML
    Replies:
    43
    Views:
    1,282
  4. Rick

    alt tags in images

    Rick, Aug 7, 2003, in forum: Javascript
    Replies:
    2
    Views:
    60
    Richard Cornford
    Aug 9, 2003
  5. trallon
    Replies:
    3
    Views:
    100
    Davey Erwin
    Sep 29, 2006
Loading...

Share This Page