Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > adding alt tags

Reply
Thread Tools

adding alt tags

 
 
N9
Guest
Posts: n/a
 
      04-30-2008
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
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      04-30-2008
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/
 
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
alt.autos.porsche928,rec.humor.oracle.d,alt.balordi.it,alt.computer,sci.med.laboratory . Computer Information 1 06-18-2004 08:44 AM



Advertisments