我有以下的<a>
标签:
<a href="http://myserver/_forms?url={@FileRef}&id=5">...</a>
其中一个文件名为"File's got apostrophe.xml"
。XSL的输出结果为:
<a href="http://myserver/_forms?url=/blah/File&#39;s got apostrophe.xml&id=5">...</a>
问题在于撇号被转义成了 HTML 转义符(两次?),变成了 &#39;
,这导致链接无法正常工作。我也尝试使用 <xsl:attribute>
,但结果相同:
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('http://myserver/_forms?url=', @FileRef, '&id=5')"
disable-output-escaping="yes" />
</xsl:attribute>
</a>
输出 <xsl:value-of select="@FileRef" disable-output-escaping="yes" />
的效果很好 - 未经转义的值会被打印到页面上。
我如何在不转义字符串的情况下设置属性?
@FileRef
字段更好。你是指整个<a>
标记,类似于tpeczek的答案吗? - Kobi