Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schematron #286

Open
robbert-harms opened this issue Feb 25, 2022 · 4 comments
Open

schematron #286

robbert-harms opened this issue Feb 25, 2022 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@robbert-harms
Copy link

Hi all,

I was wondering, would it be possible to extend or amend XMLSchema such that it can validate XML files using Schematron? I know lxml has some support for this, but this does not allow for using xslt2.0.

This ticket is a long shot and you are all probably very busy with other stuff, but I thought let's try anyway.

Best,

Robbert

@brunato
Copy link
Member

brunato commented Mar 7, 2022

Hi,
extending couldn't be an option because XMLSchema and Schematron don't have nothing in common (as i remember, conversely Relax NG uses XSD datatypes and it could have more sense).

Assertions are essentaly based on the XPath processor (elementpath), and probably it can be reused also for building XPath proxies for processing Schematron assertions.

Probably for this it could be implemented in an optional subpackage with a help from other contributors. Also better to know before which is the lxml roadmap for XLST 2.0 (and maybe other features, like XPath 2.0).

So I leave this open with an enhancement label for the moment.

Best

Davide

@brunato brunato added the enhancement New feature or request label Mar 7, 2022
@robbert-harms
Copy link
Author

Hi Davide,

Thank you for your response. I am aware that Schematron and XSD are orthogonal instruments. The common ground is indeed the need of an XPath processor.

A separate package, or a subpackage might be the goal here.

Thanks for holding it under consideration. Let's see what the community thinks of this.

Best,

Robbert

@brunato brunato added the help wanted Extra attention is needed label Mar 7, 2022
@martin-honnen
Copy link

@robbert-harms , in the Python world you now have an option to use Schematron with XPath 2 and later if you use Saxonica's saxonche package https://pypi.org/project/saxonche/ together with your favourite XSLT based implementation of Schematron (i.e. usually the ISO Schematron XSLT 2.0 implementation or the newer Schxslt by David Maus). Not related to the XmlSchema library and not a pure Python package but at least an option to have a PyPi package to perform Schematron based validation with XPath 2 or later tests/assertions.

@robbert-harms
Copy link
Author

Hi @martin-honnen,

Thanks for your comment. I am aware of the saxonche project, it is a very nice package. I still wanted something Python based and for that I have been working on this package: https://github.com/robbert-harms/pyschematron .

It is not complete yet, but when finished it will be a pure Python package build on top of the excellent elementpath library from @brunato. The parsing is done, the query binding is done, it is only pending the last step of executing the validation. It is a hobby project, expect it to be finished around summer.

Best,

Robbert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants