2013-09-22 56 views
0

我想用「string [1]」替換「Test.png」...例子「Test.png」=>「Fail.png」...用XSL替換img src標記中的圖像名稱

如何在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> 

謝謝, MUTHU Selvan SR

回答

1

使用attribute value templatesrc="{string[1]}.png"

在樣式表中的一個文字結果元素的單個屬性規範可以具有任何數量的屬性的價值模板。每個都被視爲<xsl:value-of>