Actions
Bug #5721
closed

Saxon EE 10.8J optimizations break order of XPath selectors
Start date:
2022-10-26
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
10, 11, trunk
Fix Committed on Branch:
11, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java
Description
Following XSLT fails on Saxon EE 10.8J using the default optimization level (-opt:10
). Turning the optimization off via -opt:0
returns correct results.
It seems, in this case the optimization does not keep the order of the XPath "selectors".
Error:
FORG0001 Cannot convert string "" to double
invoked by built-in template rule (text-only)
Cannot convert string "" to double
Test XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/2005/xpath-functions" exclude-result-prefixes="#all" version="3.0" xmlns:saxon="http://saxon.sf.net/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:f="http://aimtec.cz/EDI" xmlns:aim="http://aimtec.cz/INT/mappingDescription">
<xsl:output encoding="UTF-8" indent="no" method="xml"/>
<xsl:template match="root">
<test>
<!-- Filter in order: name - content - numeric value -->
<xsl:for-each select="test/*[contains(name(), 'LieferscheinNummer')][. != ''][. != 0]">
<number>
<xsl:value-of select="."/>
</number>
</xsl:for-each>
</test>
</xsl:template>
</xsl:stylesheet>
Test input:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<test>
<LieferscheinNummer_1>1</LieferscheinNummer_1>
<LieferscheinNummer_2>0</LieferscheinNummer_2>
</test>
<test>
<LieferscheinNummer_1>2</LieferscheinNummer_1>
<LieferscheinNummer_2/>
</test>
</root>
Expected output:
<?xml version="1.0" encoding="UTF-8"?>
<test xmlns="http://www.w3.org/2005/xpath-functions">
<number>1</number>
<number>2</number>
</test>
Please register to edit this issue
Actions