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

feat: support 4.0 in tests for XSLT and XQuery #1883

Merged
merged 4 commits into from
Mar 20, 2024
Merged

Conversation

galtm
Copy link
Member

@galtm galtm commented Mar 17, 2024

This PR adds one compiler change and some simple tests for use of

  • XSLT 4.0 in an XSLT SUT
  • XQuery 4.0 in an XQuery SUT
  • XPath 4.0 in a Schematron SUT or in an XSpec test for XSLT, XQuery, or Schematron

I ran the v4.0 tests interactively with Saxon-EE 12 from Oxygen, after modifying the "Run XSpec Test" transformation scenario to set saxon.custom.options to --allowSyntaxExtensions:on.

On the command line, I also ran a similar v4.0 XQuery test with BaseX 10.7, though I substituted the following for the last verification in the test. I'm having trouble finding an XPath 4.0 construct that is already implemented in both Saxon XQuery and BaseX.

<x:expect label="XPath 4.0 in the XSpec test also works"
	test="identity(4) eq 4"/>

After running external_xslt4.xspec from Oxygen, I checked that the compiled stylesheet specifies <xsl:map-entry key="'xslt-version'">4.0</xsl:map-entry> in the map of transform options.

Does #1729 require more than what's in this PR?

Puzzles (non-blocking)

  1. Despite the Saxon documentation saying that transform() needs to specify the option xslt-version="4.0" to enable 4.0 support in the transformation being called, I was able to run external_xslt4.xspec in Oxygen even without the change in transform-options.xsl.
  2. I am not sure if the Schematron usage is supposed to work (i.e., supported in Schematron itself), so consider that usage to be experimental. I logged this issue to inquire: Clarify support for XPath 4.0 or XSLT/XQuery 4.0 Schematron/schematron-enhancement-proposals#70

Presumed instructions for users

Tests for XSLT or Schematron

  1. Set xslt-version="4.0" on<x:description>
  2. Set the configuration property ALLOW_SYNTAX_EXTENSIONS (equivalently, use --allowSyntaxExtensions:on on the command line, or global/@allowSyntaxExtensions="true" in the configuration file). This step is copied from https://www.saxonica.com/documentation12/index.html#!v4extensions.

In Oxygen "Run XSpec Test" transformation scenario, you can accomplish step 2 by including --allowSyntaxExtensions:on in the saxon.custom.options parameter.

Tests for XQuery

Set xquery-version="4.0" on <x:description>

@galtm galtm added this to the v3.0 milestone Mar 17, 2024
@galtm galtm linked an issue Mar 19, 2024 that may be closed by this pull request
@galtm galtm requested a review from AirQuick March 19, 2024 21:03
@galtm galtm enabled auto-merge (squash) March 20, 2024 13:37
@galtm galtm merged commit 8201442 into xspec:master Mar 20, 2024
38 checks passed
@galtm galtm deleted the xslt4 branch March 20, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support 4.0
1 participant