Bug #1498
closedVariable containing an xsl:analyse-string result appears to be optimised out before being passed to a function
0%
Description
I'm using Saxon.Net PE 9.3.0.5 on Windows 7 with .NET Framework 2.0 - this problem may be related to something I came across in Saxon-CE, but assumed at the time it was specific to that variant (if memory serves - a closure was being used, but this failed to restore the analyze-string evaluation context when required)
I've attached the 2 files required to reproduce this issue, and the 2 different outputs I get. The following XSLT 2.0 is at the heart of the matter:
...
<xsl:otherwise>
<xsl:variable name="parts" as="xs:string*">
<xsl:analyze-string regex="".*?"|'.*?'|[^'"]+|['"]" select="$token">
<xsl:matching-substring>
<xsl:value-of select="."/>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="."/>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:variable>
<xsl:sequence select="f:getAttributes($parts, 1)"/>
<dummy><xsl:value-of select="$parts[1]"/></dummy>
<!-- must be an open tag, so check for attributes -->
</xsl:otherwise>
This code will run as expected, with the call to f:getAttributes providing the expected result sequence and the element also being added to the result tree. However, if the element is commented out the result is entirely different - as if analyze-string had failed to 'tokenize' the input string into parts.
Files
Please register to edit this issue