adding alt tags

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • N9

    adding alt tags

    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
  • Martin Honnen

    #2
    Re: adding alt tags

    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:attribut e name="alt"></xsl:attribute>
    </xsl:copy>
    </xsl:template>






    --

    Martin Honnen

    Comment

    Working...