Project

Profile

Help

Bug #2557

closed

<xsl:evaluate with-params="$map"/> does not seem to work

Added by Pieter Masereeuw almost 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT conformance
Sprint/Milestone:
-
Start date:
2015-12-22
Due date:
% Done:

100%

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

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

output.txt (1.49 KB) output.txt Pieter Masereeuw, 2015-12-22 08:47
testmap.xslt (908 Bytes) testmap.xslt Pieter Masereeuw, 2015-12-22 08:47
Actions #1

Updated by Michael Kay almost 9 years ago

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.

Actions #2

Updated by Michael Kay almost 9 years ago

  • 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

Actions #3

Updated by Pieter Masereeuw almost 9 years ago

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) }"/>

Actions #4

Updated by O'Neil Delpratt almost 9 years ago

  • % 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

Actions #5

Updated by O'Neil Delpratt almost 9 years ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF