Project

Profile

Help

Bug #1498

closed

Variable containing an xsl:analyse-string result appears to be optimised out before being passed to a function

Added by Philip Fearon about 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
User error
Sprint/Milestone:
-
Start date:
2012-04-25
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

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="&quot;.*?&quot;|'.*?'|[^'&quot;]+|['&quot;]" 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

convert-xml.xsl (7.5 KB) convert-xml.xsl A 'nieve' XML Parser Philip Fearon, 2012-04-25 20:59
test-render3.xml (378 Bytes) test-render3.xml Test XML file that's parsed as plain-text Philip Fearon, 2012-04-25 20:59
3.1-test-render3.xml (920 Bytes) 3.1-test-render3.xml The output - with dummy element commented out Philip Fearon, 2012-04-25 20:59
4.1-test-render3.xml (1.72 KB) 4.1-test-render3.xml The expected output - produced with dummy element in Philip Fearon, 2012-04-25 21:04
Actions #1

Updated by Philip Fearon about 12 years ago

Added the expected output file

Actions #2

Updated by Michael Kay almost 12 years ago

  • Category set to User error
  • Status changed from New to Closed
  • Assignee set to Michael Kay
  • Priority changed from Low to Normal
  • Found in version changed from Saxon.net 9.3.0.5 to 0.0

Further investigation showed that this was a user error. The details have been forgotten with time.

Please register to edit this issue

Also available in: Atom PDF