[英]How can I use use “xsl:attribute” to set the src-URL for displaying an image?
The code below does not show the image I want to display: 以下代码未显示我要显示的图像:
<img">
<xsl:attribute name="src">
<xsl:value-of select="//image"/>
</xsl:attribute>
</img>
although the path to the image exists! 尽管存在图像路径! Any idea what is wrong on this code?
知道这段代码有什么问题吗?
You can use this 你可以用这个
<img>
<xsl:attribute name="src">
<xsl:value-of select='imgsource'/>
</xsl:attribute>
</img>
BUT 但
inside you xml there must be the path to the image with the variable imgsource, like this: 在您的xml内,必须具有变量imgsource的图像路径,如下所示:
<imgsource>http://www.test.com/Images/image.JPG</imgsource>
hence imgsource is like a variable not the path to the image. 因此imgsource就像一个变量,而不是图像的路径。
You can try do this with variable 您可以尝试使用变量执行此操作
<xsl:variable name="imgSrc" select="//image" />
<img src="$imgSrc" alt=""/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.