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

Enable XSpec to work with XQS implementation of Schematron #1804

Open
galtm opened this issue Nov 8, 2023 · 0 comments
Open

Enable XSpec to work with XQS implementation of Schematron #1804

galtm opened this issue Nov 8, 2023 · 0 comments

Comments

@galtm
Copy link
Collaborator

galtm commented Nov 8, 2023

XQS is an emerging XQuery-based implementation of Schematron. Its status as of 11/2023 is "pre-release."
https://github.com/AndrewSales/XQS

It would be useful if XQS users could run XSpec tests against their Schematron code. But not every Schematron schema that runs with XQS will run with an XSLT-based implementation of Schematron. In particular, XQS-compatible Schematron schemas are allowed to include user-defined functions written in XQuery (just as SchXslt-compatible Schematron schemas are allowed to include user-defined XSLT functions).

When XSpec compiles a test for Schematron, it generates XSpec code that runs against a compiled-to-XSLT form of the schema. Can we provide an option to generate XSpec code that runs against a compiled-to-XQuery form of the schema? Long term, perhaps XSpec would support both SchXslt and XQS as Schematron implementation options.

I did a little exploring and noticed a few things that would be needed. This is not a comprehensive list.

  1. The XSpec compiler needs to know which implementation to use. Should the decision use environment variables, Ant properties, the queryBinding attribute in the Schematron schema, some markup in the XSpec test, or something else? (The answer might even be a combination, and it might change as XQS matures.)

  2. The generated XSpec code needs to locate the XQS implementation, and we'd need to determine how to access XQS. xqs:validate() is a candidate if the user's XQuery engine is BaseX. Alternatively, xqs:compile() creates code that is apparently portable across XQuery engines, so it would be nice if such a compilation result could be used by XSpec.

  3. The generated XSpec code needs to express the context to validate in terms of x:call because XSpec tests for XQuery code do not use x:context.

  4. In the generated XSpec code, x:expect/@test attributes should use $x:result instead of assuming a context item exists, because XSpec tests for XQuery code do not define a context item in x:expect/@test. This change affects several lines like this.

  5. @xslt-version is not relevant when the generated XSpec code targets XQuery.

  6. Either src/schematron/select-node.xsl needs a corresponding XQuery implementation, or the generated XSpec code needs to replace calls to functions in that module with something else.

Cc: @AndrewSales, @adamretter, @vincentml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant