Bug #1472
closedSaxon says "cannot compare" (schema-aware mode) for an XPath expression
100%
Description
I translated a schematron schema into an XSLT stylesheet. When I run it against an XML document with XSD schema attached, it gives the error "XPTY0004: Cannot compare".
The problem seems to be the expression "qualification/@open eq true()", but that seems right to me, since @open is defined in the schema to be a xs:boolean.
Files
Updated by Jakub Maly over 12 years ago
I am running saxon from the command line:
java -jar saxon9ee.jar -sa -s:TournamentsSchedule.xml -o:out.svrl -xsl:TournamentsScheduleSA.xslt.
Updated by Jakub Maly over 12 years ago
I entered wrong version number, it should be: SAXON-EE 9.4.0.3J
Updated by Michael Kay over 12 years ago
- Status changed from New to In Progress
- Assignee set to Michael Kay
You need to add -val:strict to the command line to ensure that the source file is validated against the schema.
The clue is in the message
Comparison of xs:untypedAtomic? to xs:boolean will fail unless the first operand is empty
which tells you that the input document is untyped.
I shall look at the message "Cannot compare" to see how it can be improved.
Updated by Jakub Maly over 12 years ago
Thank you for directing me to -val:strict.
The warning
Comparison of xs:untypedAtomic? to xs:boolean will fail unless the first operand is empty
Is printed only when I run it without -sa switch, when I added -sa, the warning disappeared. That is why I assumed the schema was loaded and taken into account.
Updated by Michael Kay over 12 years ago
Ah yes. Without -sa, the compiler knows that data will be untyped and can make inferences based on this. With -sa, the compiler doesn't know whether the data at run-time will be typed or untyped, so it can't issue the warning. The thing that causes the data to be validated and therefore typed is the -val flag.
Updated by Michael Kay over 12 years ago
I have fixed the error message on the development branch only.
Updated by Michael Kay over 12 years ago
- Status changed from In Progress to Resolved
- Found in version changed from 1.0.2-94 to 9.4
Updated by Michael Kay over 12 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in version set to 9.4.0.4
Please register to edit this issue