Muthu Selvan SR
Muthu Selvan SR

Reputation: 21

Replace the image name in img src tag in XSL

I want replace "Test.png" with "string[1]" ...Example "Test.png" => "Fail.png" ...

How to do that in XSL ?

 <xsl:when test="string[1] = 'Fail'">
     <td> <a href="http://www.google.com/"><img src="Test.png" height="182" width="182"></img></a></td>
 </xsl:when>
<xsl:otherwise>
      <td> </td>
  </xsl:otherwise>
</xsl:choose>

Thanks , Muthu Selvan SR

Upvotes: 0

Views: 489

Answers (1)

G. Ken Holman
G. Ken Holman

Reputation: 4403

Use an attribute value template: src="{string[1]}.png"

A single attribute specification in a literal result element in the stylesheet can have any number of attribute value templates. Each is treated as an <xsl:value-of>.

Upvotes: 1

Related Questions