In an XML data file I have a collection of images <image_list>
; within this collection, I have images with different names (given in the <image_result>
name attribute).
在XML数据文件中,我有一个图像集合
How can I escape the quotes so that this will work? I've tried using "
or \"
for both sets of quotes, but emacs lights up red, indicating a formatting error.
我怎么才能把引号转义呢?我试着用“;或者“\”对于两组引号,但是emacs会亮起红色,表示格式错误。
XSL snippet:
XSL代码片段:
<table>
<tr>
<xsl:for-each select="image_list/image_result">
<td>
<img src ="<xsl:value-of select="name"/>" style="width:450px"/>
</td>
</xsl:for-each>
</tr>
</table>
3 个解决方案
#1
7
Your XSLT needs to be a well-formed XML document, so the type of construct you're attempting is simply not possible. Use an Attribute Value Template instead:
您的XSLT必须是格式良好的XML文档,所以您尝试的构造类型根本不可能。使用属性值模板:
<img src="{name}" style="width:450px"/>
#2
2
You can use xsl:attribute
:
您可以使用xsl:属性:
<td>
<img style="width:450px">
<xsl:attribute name="src">
<xsl:value-of select="name"/>
</xsl:attribute>
</img>
</td>
Or the simplified option (using the attribute value template):
或简化选项(使用属性值模板):
<td>
<img src="{name}" />" style="width:450px"/>
</td>
#3
2
<td>
<img src="{name}" style="width:450px"/>
</td>
< td > < img src = " {名称}”风格= "宽度:450 px " / > < / td >
should do it.
应该这样做。
#1
7
Your XSLT needs to be a well-formed XML document, so the type of construct you're attempting is simply not possible. Use an Attribute Value Template instead:
您的XSLT必须是格式良好的XML文档,所以您尝试的构造类型根本不可能。使用属性值模板:
<img src="{name}" style="width:450px"/>
#2
2
You can use xsl:attribute
:
您可以使用xsl:属性:
<td>
<img style="width:450px">
<xsl:attribute name="src">
<xsl:value-of select="name"/>
</xsl:attribute>
</img>
</td>
Or the simplified option (using the attribute value template):
或简化选项(使用属性值模板):
<td>
<img src="{name}" />" style="width:450px"/>
</td>
#3
2
<td>
<img src="{name}" style="width:450px"/>
</td>
< td > < img src = " {名称}”风格= "宽度:450 px " / > < / td >
should do it.
应该这样做。