Add exception handling to schematron
This should cover W3C XML Schema, Relax NG and DTD related problems.
Add exception handling to schematron
Hi,
currently it can be quite difficult to find the responsible code when an exception occurs during schematron validation.
Thus, I modified the skeleton script to support queryBinding "xslt3". In this mode the execution of each pattern is surrounded by an xsl:try. In the xsl:catch it reports the error description together with the id/title of the pattern and also finds the responsible schematron code (by evaluating $err:line-number and identify the element in the stylesheet itself with the same line number and use the @oxy:elementLine).
This works fine when running the generated xslt manually. However, when overwriting the builtin skeleton stylesheets and validate my xml, it complains about "Unknown XSLT element: try". This confuses me, since I configured oXygen to use Saxon EE (which supports xslt 3.0) for schematron validation and the generated stylesheet has version set to 3.0!?
Is it not possible to use XSLT v3.0 within schematron or is there anything I can do about it?
Thanks and regards,
Patrik
currently it can be quite difficult to find the responsible code when an exception occurs during schematron validation.
Thus, I modified the skeleton script to support queryBinding "xslt3". In this mode the execution of each pattern is surrounded by an xsl:try. In the xsl:catch it reports the error description together with the id/title of the pattern and also finds the responsible schematron code (by evaluating $err:line-number and identify the element in the stylesheet itself with the same line number and use the @oxy:elementLine).
This works fine when running the generated xslt manually. However, when overwriting the builtin skeleton stylesheets and validate my xml, it complains about "Unknown XSLT element: try". This confuses me, since I configured oXygen to use Saxon EE (which supports xslt 3.0) for schematron validation and the generated stylesheet has version set to 3.0!?
Is it not possible to use XSLT v3.0 within schematron or is there anything I can do about it?
Thanks and regards,
Patrik
Re: Add exception handling to schematron
Hi Patrik,
You need to leave the query binding set to "xslt2". Just make sure that the result stylesheet has 3.0 version.
For this you just need to change the the following line from skeleton:
to:
Best Regards,
Octavian
You need to leave the query binding set to "xslt2". Just make sure that the result stylesheet has 3.0 version.
For this you just need to change the the following line from skeleton:
Code: Select all
<xsl:attribute name="version">2.0</xsl:attribute>
Code: Select all
<xsl:attribute name="version">3.0</xsl:attribute>
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: Add exception handling to schematron
Hi Tavy,
keeping queryBinding on xslt2 and adding an additional parameter "exception-handling" instead indeed solved this problem. Thanks for that.
Unfortunately, now the next problem arised: When executing the generated script during validation, document('') does not return the xslt code (which I need to interpret $err:line-number for identifying the actual line number in the schematron file) but the schematron code. Do you know any way to get access to the xslt code from within the xslt script?
(My workaround would be to to duplicate the code during xslt generation and put it into a variable.)
Thanks and regards,
Patrik
keeping queryBinding on xslt2 and adding an additional parameter "exception-handling" instead indeed solved this problem. Thanks for that.
Unfortunately, now the next problem arised: When executing the generated script during validation, document('') does not return the xslt code (which I need to interpret $err:line-number for identifying the actual line number in the schematron file) but the schematron code. Do you know any way to get access to the xslt code from within the xslt script?
(My workaround would be to to duplicate the code during xslt generation and put it into a variable.)
Thanks and regards,
Patrik
Re: Add exception handling to schematron
Hi Patrik,
Yes, we set the systemId of the schematron during validation for the stylesheet. This is because we what that any reference to document('') from schematron to be translated to the schematron system ID. The stylesheet is a temporarily file, so we don't want that document('') to refer to a temporarily file.
Best Regards,
Octavian
Yes, we set the systemId of the schematron during validation for the stylesheet. This is because we what that any reference to document('') from schematron to be translated to the schematron system ID. The stylesheet is a temporarily file, so we don't want that document('') to refer to a temporarily file.
Best Regards,
Octavian
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service