I noticed when trying to use disable-output escaping in XSLT3 in Saxon that it would not work if expand-text was set to yes on the stylesheet or even on the given match template
The following code (when run on itself) shows the issue (in Saxon 9.8.0.12). I know this is an unusual combination and that disable-output-escaping in normally to be avoided at all costs but just trying to ascertain correct behavior.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
<xsl:template match="/">
<out>
<xsl:apply-templates/>
</out>
</xsl:template>
<xsl:template match="xsl:stylesheet" expand-text="true">
<expandtext>
<count>{count(*)}</count>
<xsl:text disable-output-escaping="true"><test/></xsl:text>
</expandtext>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="xsl:template" expand-text="false">
<notexpandtext>
<count>{count(*)}</count>
<xsl:text disable-output-escaping="true"><test/></xsl:text>
</notexpandtext>
</xsl:template>
</xsl:stylesheet>
produces
<?xml version="1.0" encoding="UTF-8"?>
<out>
<expandtext><count>3</count><test/></expandtext>
<notexpandtext><count>{count(*)}</count><test/></notexpandtext>
<notexpandtext><count>{count(*)}</count><test/></notexpandtext>
<notexpandtext><count>{count(*)}</count><test/></notexpandtext>
</out>
Indeed there is a bug here, which I have logged at
https://saxonica.plan.io/issues/4412
An xsl:text
instruction within the scope of expand-text="yes"
is implemented internally as a different kind of expression from a "plain old" xsl:text
element, and the new expression overlooked the need to support d-o-e.
I have added a test case disable-output-escaping/doe-0201
to the XSLT 3.0 test suite at https://github.com/w3c/xslt30-test
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With