在 XML 数据文件中,我有一组图像 <image_list>
;在这个集合中,我有不同名称的图像(在 <image_result>
名称属性中给出)。
我怎样才能转义引号,这样它才能工作?我试过使用 "
或 \"
对于两组引号,但 emacs 亮起红色,表示格式错误。
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>
最佳答案
您的 XSLT 需要是格式良好的 XML 文档,因此您尝试的构造类型根本不可能。使用 Attribute Value Template相反:
<img src="{name}" style="width:450px"/>
关于html - XSL : set image src using attribute 中的引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7841075/