Project

Profile

Help

Support #2252

closed

Strict XSL validation yields less messages than validating during parse

Added by Jason Mihalick over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2014-12-09
Due date:
% Done:

0%

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

Description

I am using Saxon-EE Java version 9.5.1.7.

We have the following scenario using xsl:validation="strict" in a stylesheet.

I run a source document through a transformation which has xsl:validation="strict" on the root element of the output XML, I get the following 4 error messages:

  • 'In content of element : The content model does not allow element to appear immediately after element . The following elements would be valid here, all in no namespace: funding-info, processing-relationships, x (or nothing). '

  • 'In content of element : The content model does not allow element to appear immediately after element

    . Expected

    or nothing. '

  • 'In content of element : The content model does not allow element to appear immediately after element . It must be preceded by one of: , . '

  • 'In content of element : The content model does not allow element to appear as the first child. Expected . '

But when I run the same transformation WITHOUT the xsl:validation="strict" present, and then validate the transformed output XML afterwards (using an XMLReader), I get the following 10 error messages (which is closer to what I expect to see):

  • 'cvc-complex-type.2.4.b: The content of element 'ref' is not complete. One of '{label, live-change, acs-titles, acs-no-titles, acs-biochem, citation, note}' is expected.'

  • 'cvc-attribute.3: The value 'sameIdCheck' of attribute 'id' on element 'ref' is not valid with respect to its type, 'ID'.'

  • 'cvc-id.2: There are multiple occurrences of ID value 'sameIdCheck'.'

  • 'cvc-complex-type.2.4.b: The content of element 'ref' is not complete. One of '{label, live-change, acs-titles, acs-no-titles, acs-biochem, citation, note}' is expected.'

  • 'cvc-complex-type.2.4.a: Invalid content was found starting with element 'ref'. One of '{funding-info, processing-relationships, x}' is expected.'

  • 'cvc-attribute.3: The value '´' of attribute 'id' on element 'fig' is not valid with respect to its type, 'ID'.'

  • 'cvc-datatype-valid.1.2.1: '´' is not a valid value for 'NCName'.'

  • 'cvc-complex-type.2.4.a: Invalid content was found starting with element 'fig'. One of '{p}' is expected.'

  • 'cvc-complex-type.2.4.a: Invalid content was found starting with element 'contrib-group'. One of '{document-title, web-title}' is expected.'

  • 'cvc-complex-type.2.4.a: Invalid content was found starting with element 'foo'. One of '{journal-id}' is expected.'

Should I expect roughly the same messages to be produced during the transformation validation of the output vs. a transformation followed by a validation? I am not expecting the text to match exactly, but I was expecting to see basically the same errors caught. Notice, for example, that none of the ID related errors were caught when validating during transformation.

I can provide a stylesheet and source XML if necessary, but I thought I would start at a higher level first before we get deeper. Perhaps there is a reason in the Saxon implementation or in the spec that this scenario of validating during transformation vs. validating afterwards will never produce the same errors.


Files

schema.xsd (749 Bytes) schema.xsd Jason Mihalick, 2014-12-10 23:43
SaxonIDValidationTest.java (6.06 KB) SaxonIDValidationTest.java Jason Mihalick, 2014-12-10 23:43

Please register to edit this issue

Also available in: Atom PDF