Project

Profile

Help

Bug #1472

closed

Saxon says "cannot compare" (schema-aware mode) for an XPath expression

Added by Jakub Maly over 12 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Schema-Aware processing
Sprint/Milestone:
-
Start date:
2012-04-07
Due date:
% Done:

100%

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

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

TournamentsSchedule.xml (1.05 KB) TournamentsSchedule.xml Jakub Maly, 2012-04-07 17:45
TournamentsSchedule.xsd (1.48 KB) TournamentsSchedule.xsd Jakub Maly, 2012-04-07 17:45
TournamentsScheduleSA.xslt (9.43 KB) TournamentsScheduleSA.xslt Jakub Maly, 2012-04-07 17:45
Actions #1

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.

Actions #2

Updated by Jakub Maly over 12 years ago

I entered wrong version number, it should be: SAXON-EE 9.4.0.3J

Actions #3

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.

Actions #4

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.

Actions #5

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.

Actions #6

Updated by Michael Kay over 12 years ago

I have fixed the error message on the development branch only.

Actions #7

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
Actions #8

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

Also available in: Atom PDF