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:
其中一个文件叫做“File's got apostrophee .xml”。XSL的输出是:
<a href="http://myserver/_forms?url=/blah/File&#39;s got apostrophe.xml&id=5">...</a>
The problem is that the apostrophe is HTML-escaped (twice?) into &#39;
, which breaks the link.
问题是撇号被html转义(两次?)到& #39;,这破坏了链接。
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?
如何在不转义字符串的情况下设置属性?
2 个解决方案
#1
17
You can generate your <a> as text:
您可以将作为文本生成:
<xsl:text disable-output-escaping="yes"><a href="</xsl:text>
<xsl:value-of select="concat('http://myserver/_forms?url=', @FileRef, '&id=5')" disable-output-escaping="yes" />
<xsl:text disable-output-escaping="yes">" >/a<</xsl:text>
#2
5
I know I'm a bit late on this, but I think the attribute tag is the way to, you just don't want to concat...
我知道我有点晚了,但是我认为属性标签是一种方式,你只是不希望concat。
<a>
<xsl:attribute name="href">
http://myserver/_forms?url=<xsl:value-of select="@FileRef" disable-output-escaping="yes" />&id=5
</xsl:attribute>
</a>
#1
17
You can generate your <a> as text:
您可以将作为文本生成:
<xsl:text disable-output-escaping="yes"><a href="</xsl:text>
<xsl:value-of select="concat('http://myserver/_forms?url=', @FileRef, '&id=5')" disable-output-escaping="yes" />
<xsl:text disable-output-escaping="yes">" >/a<</xsl:text>
#2
5
I know I'm a bit late on this, but I think the attribute tag is the way to, you just don't want to concat...
我知道我有点晚了,但是我认为属性标签是一种方式,你只是不希望concat。
<a>
<xsl:attribute name="href">
http://myserver/_forms?url=<xsl:value-of select="@FileRef" disable-output-escaping="yes" />&id=5
</xsl:attribute>
</a>