Bug #2557
closed
<xsl:evaluate with-params="$map"/> does not seem to work
Category:
XSLT conformance
Fix Committed on Branch:
9.7
Fixed in Maintenance Release:
Description
Saxon crashes when it tries to evaluate the following statement:
<xsl:evaluate xpath="$xpath2" with-params="$map"/>
I attach a stylesheet that reproduces the problem and also its output.
Although the traceback mentions a ClassCastException, the problem also exists if I try another expression, such as concatenating strings.
Input can be any XML file, including the stylesheet itself.
Or am I misinterpreting the specs?
Files
I get the error
java.lang.ClassCastException: net.sf.saxon.value.StringValue cannot be cast to net.sf.saxon.value.QNameValue
This is because the keys in the parameter map should be QNames (instances of xs:QName) rather than strings.
But of course Saxon should fail with a proper error message, not with a ClassCastException.
I have added this as test case evaluate-043 to the W3C XSLT 3.0 test suite.
- Category set to XSLT conformance
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch 9.7 added
- Fix Committed on Branch 9.7 added
I'm assuming you were running 9.7. With 9.6, Saxon reports that the @with-params attribute is not yet implemented.
I've committed a patch to return a proper error message. I found that there wasn't an error code allocated in the XSLT 3.0 specification (though it's clear that the key must be an xs:QName) and I have raised bug 29351 [1] to propose that we allocate code XTTE3165 to this condition.
[1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=29351
I can confirm that the correction with xs:QName() works - thank you!.
For people ever arriving at this place:
I should have written:
<xsl:variable name="map" select="map { xs:QName('beast') : xs:integer(666) }"/>
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.7.0.2 added
Bug fix applied in the Saxon 9.7.0.2 maintenance release
- Status changed from Resolved to Closed
Please register to edit this issue
Also available in: Atom
PDF