XSL - How to disable output escaping for an attribute?

Posted by Kobi on Stack Overflow See other posts from Stack Overflow or by Kobi
Published on 2010-05-27T12:38:19Z Indexed on 2010/05/27 12:41 UTC
Read the original article Hit count: 189

I've had the following <a> tag:

<a href="http://myserver/_forms?url={@FileRef}&amp;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&amp;#39;s got apostrophe.xml&id=5">...</a>

The problem is the the apostrophe is HTML-escaped (twice?) into &amp;#39;, 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, '&amp;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?

© Stack Overflow or respective owner

Related posts about Xml

Related posts about sharepoint