Project

Profile

Help

Support #6496

closed

Saxon PE Assert

Added by Rick Harvey 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Command Line
Sprint/Milestone:
-
Start date:
2024-08-07
Due date:
% Done:

0%

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

Description

I'm having trouble getting assert to trigger using:

  • Out-of-the-box Saxonica release (Saxon-PE-12.5)
  • An XSLT containing asserts (AUNZ-Billing-Shared.xslt)
  • A deliberately erroneous XML file (Invalid.xml)
$ java -jar SaxonPE12-5J/saxon-pe-12.5.jar -t -ea:on -s:Invalid.xml -xsl:AUNZ-Billing-Shared.xslt -o:zresult.xml

Which produces a result file showing no assert was triggered (zresult.xml).

What am I doing wrong?


Files

Invalid.xml (20.4 KB) Invalid.xml File to be validated Rick Harvey, 2024-08-07 15:09
AUNZ-Billing-Shared.xslt (237 KB) AUNZ-Billing-Shared.xslt XSLT validation contaiing assert Rick Harvey, 2024-08-07 15:09
zresult.xml (43.6 KB) zresult.xml Result of validation showing assert not triggered Rick Harvey, 2024-08-07 15:09
PINT-UBL-validation-preprocessed.sch (77.3 KB) PINT-UBL-validation-preprocessed.sch Schematron Rick Harvey, 2024-08-07 17:13
PINT-UBL-validation-preprocessed.xslt (238 KB) PINT-UBL-validation-preprocessed.xslt XSLT Rick Harvey, 2024-08-07 17:13
AUNZ-Billing-Aligned.xslt (122 KB) AUNZ-Billing-Aligned.xslt Rick Harvey, 2024-08-08 09:53
Actions #1

Updated by Martin Honnen 4 months ago

Do you use any XSLT xsl:assert https://www.w3.org/TR/xslt-30/#element-assert?

It seems your XSLT might be some compilation of a Schematron document and you expect it to produce validation errors/Schematron failed validations but the Saxon command line option -ea will certainly not help with those.

Which failed assert are you expecting? Do you have the original Schematron file as well from which the shown XSLT was compiled?

Actions #2

Updated by Martin Honnen 4 months ago

Is the comment at the beginning of the XML sample supposed to indicate which failed Schematron assertion you are expecting?

Note that the XSLT you posted doesn't seem to contain any code checking starts-with(normalize-space(cbc:CustomizationID/text()), 'urn:peppol:pint:billing-1@aunz-1').

Actions #3

Updated by Rick Harvey 4 months ago

Attached is the source schematron (PINT-UBL-validation-preprocessed.sch) and XSLT (PINT-UBL-validation-preprocessed.xslt).

Actions #4

Updated by Martin Honnen 4 months ago

What is the relation between AUNZ-Billing-Shared.xslt and the added PINT-UBL-validation-preprocessed.xslt?

The question remains, do you expect -ea:on to be of any use/help for Schematron based validation? It is meant for XSLT xsl:assert, I think, only.

Also with longish/complex samples it always helps which precise result you want.

The added Schematron seems to have an error to declare xs for the XML schema namespace but at one point have a rule trying to use the xsd prefix.

Actions #5

Updated by Michael Kay 4 months ago

This is why it's so important that we see your actual code -- I had assumed you were asking about xsl:assert.

What we have here is a stylesheet, generated it appears by Schematron, that isn't producing the output you would have expected. So essentially, I think you're asking us for help debugging your code. Debugging user-written code isn't part of our normal support offer. We'll take a look at it, but this is a 3300 line stylesheet and we have no understanding of the XML or of exaclly what it's trying to do, so I can't offer any guarantees.

What exactly is invalid about the invalid.xml file? That will help us get started.

Actions #6

Updated by Rick Harvey 4 months ago

Hi Michael (and Martin)

Thank you very much for your quick response and analysis.

Indeed, it looks like a problem that the test file (Invalid.xml) not actually being invalid against the specification (*.sch, *.xslt).

I will report this back to the Australian Government, which produced these files. (https://peppol.org/learn-more/country-profiles/australia/)

You may close this issue. As your (very nice) product seems to be working as expected.

Thanks again...Rick

Actions #7

Updated by Rick Harvey 4 months ago

I got a reply back from the AU Government - Peppol documents need to be validated against both Shared and Aligned XSLTs.

The test file (Invalid.xml) validates against Shared (above) but does not validate against Aligned (attached).

Sorry for my ignorance. However, I now know a lot more about your product. :-)

Thanks...Rick

Actions #8

Updated by Michael Kay 4 months ago

  • Status changed from New to Closed

Glad to hear the problem is resolved.

Please register to edit this issue

Also available in: Atom PDF