3

Probably a bug in Saxon but just wanted to clarify-

<xsl:value-of select="unparsed-text('http://something/test.txt')" 
    disable-output-escaping="yes"/>

Result -

<div>test</div>

Now try-

<xsl:try>
 <xsl:value-of select="unparsed-text('http://something/test.txt')" 
    disable-output-escaping="yes"/>
<xsl:catch></xsl:catch>
</xsl:try>

Result-

&lt;div&gt;test&lt;/div&gt;

Any thoughts on why this is happening?

Vinit
  • 1,815
  • 17
  • 38

2 Answers2

7

Interesting one. Disable-output-escaping only works when you are writing output directly from the transformer to the serializer (that is, when construction of a result tree is effectively being bypassed). Within xsl:try, output can't be written directly to the serializer because of the possibility that it will need to be "rolled back" in the event that a dynamic error occurs; so it's effectively written to a hidden internal variable, whose contents are only sent to the serializer when it's known that no failure has occurred. Since disable-output-escaping is very much implementation-defined, this behaviour isn't non-conformant, but at the very least it would be reasonable to expect it to be documented.

C. M. Sperberg-McQueen
  • 24,596
  • 5
  • 38
  • 65
Michael Kay
  • 156,231
  • 11
  • 92
  • 164
  • Thanks for the response. I will probably stick to just using unparsed-text-available() for now instead of using the try/catch block =) – Vinit Apr 02 '15 at 23:17
  • 1
    2018 update: for the upcoming Saxon 9.9 release, the way try/catch buffers output has been changed, and this has the consequence that `disable-output-escaping` will work, provided of course that the output of the try/catch is being written to a serializer. – Michael Kay Aug 04 '18 at 20:12
1

From the XSLT 3.0 specs:

For backwards compatibility reasons, XSLT 3.0 continues to support the disable-output-escaping feature introduced in XSLT 1.0. This is an optional feature and implementations are not required to support it.

bjimba
  • 928
  • 8
  • 13