2009-06-03 62 views
0

我如何能實現這樣的事情:XSLT元素會導致錯誤

<img alt="logo" src="/Content/Images/Logos/<xsl:value-of select="/customer/country"/>.png" /> 

的XSLT處理器拋出,因爲「<」的錯誤 - 在這裏簽名......

回答

1

你可以使用:

<img alt="logo" > 
    <xsl:attribute name="src"> 
     /Content/Images/Logos/<xsl:value-of select="/customer/country"/>.png 
    </xsl:attribute> 
</img> 
0

元素不能嵌套在屬性值中。您可以使用{...}嵌入XPath,如下所示:

<img alt="logo" src="/Content/Images/Logos/{/customer/country}.png" />