XSL - 如何禁用属性的输出转义?
我有以下 标记:
<a href="http://myserver/_forms?url={@FileRef}&id=5">...</a>
其中一个文件名为 “File's got apostrope.xml”
。 XSL 的输出是:
<a href="http://myserver/_forms?url=/blah/File&#39;s got apostrophe.xml&id=5">...</a>
问题是撇号被 HTML 转义(两次?)到 '
中,这会破坏链接。
我还尝试使用
,结果相同:
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('http://myserver/_forms?url=', @FileRef, '&id=5')"
disable-output-escaping="yes" />
</xsl:attribute>
</a>
输出
效果很好 - 未转义的值打印在页面上。
如何在不转义字符串的情况下设置属性?
I've had the following <a>
tag:
<a href="http://myserver/_forms?url={@FileRef}&id=5">...</a>
One of the files is called "File's got apostrophe.xml"
. The output of the XSL is:
<a href="http://myserver/_forms?url=/blah/File's got apostrophe.xml&id=5">...</a>
The problem is that the apostrophe is HTML-escaped (twice?) into '
, which breaks the link.
I've also tried using <xsl:attribute>
, with same results:
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('http://myserver/_forms?url=', @FileRef, '&id=5')"
disable-output-escaping="yes" />
</xsl:attribute>
</a>
Outputting <xsl:value-of select="@FileRef" disable-output-escaping="yes" />
works well - the unescaped value is printed on the page.
How can I set the attribute without escaping the string?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
您可以生成您的 作为文本:
You can generate your <a> as text: