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

"Warning XSLT version ignored" output when using Jing with Saxon 11.4 #277

Open
rdeltour opened this issue Dec 7, 2022 · 6 comments · May be fixed by #278
Open

"Warning XSLT version ignored" output when using Jing with Saxon 11.4 #277

rdeltour opened this issue Dec 7, 2022 · 6 comments · May be fixed by #278

Comments

@rdeltour
Copy link

rdeltour commented Dec 7, 2022

When using Jing with Saxon 11.4, the following warning is reported (when using Schematron)

Warning
  XSLT version ignored: only "3.0" is recognized

This is due to Jing's Saxon factory setting the XSLT_VERSION feature to "2.0" (in NewSaxonSchemaReaderFactory), which is reported by Saxon (in the Configuration class).

I'm not quite sure since when Saxon reports that (probably since it implements XSLT 3.0).

The workaround I found in EPUBCheck (see w3c/epubcheck#1448) is to provide a custom SchematronSchemaReaderFactory via SPI, which does not set that feature.

I don't know how to best silence this warning in Jing, or if Jing should try to to not set that feature when detecting Saxon's XSLT 3.0 support. Any advice @ndw?

@ndw
Copy link
Contributor

ndw commented Dec 7, 2022

Let me give it some thought. Busy week and my brain is currently overfull.

@rdeltour
Copy link
Author

rdeltour commented Dec 7, 2022

Let me give it some thought. Busy week and my brain is currently overfull.

Of course, nothing pressing on my side! We have a workaround in EPUBCheck.

@michaelhkay
Copy link

At one time (before 3.0 was finalised) Saxon had the option to operate as either a 2.0 or a 3.0 conformant processor. If you selected 2.0 (in the API), then we tried hard to suppress all 3.0 features such as new functions, xsl:iterate, etc. Simply setting version="2.0" in the stylesheet doesn't have this effect (3.0 features will still work, so you don't pass the conformance tests for 2.0). At some later date we decided we would no longer have a 2.0-conformant mode: if you request 2.0, we fall back to 3.0, so you get the 3.0 features whether you like it or not. We made this decision because the level of backwards compatibility between 2.0 and 3.0 is very high, so pretty well all non-error stylesheets will run unchanged. If you ask for 2.0 conformance, we can't meet your request, so we give a warning that we are falling back to 3.0. I think that's reasonable.

More recently we've been going through all the warning messages making sure they all have unique error codes so it's easier to suppress them in an ErrorReporter. It looks like I missed this one: I'll fix that.

@rdeltour
Copy link
Author

Thanks for the explanation @michaelhkay!

the level of backwards compatibility between 2.0 and 3.0 is very high, so pretty well all non-error stylesheets will run unchanged

so, can we safely assume that setting the "XSLT_VERSION" feature in Jing is effectively useless ? (or irrelevant even in Saxon versions which did have a 2.0-conformant mode?)

I'm trying to figure out if removing that configuration:

factory.setAttribute(FeatureKeys.XSLT_VERSION, "2.0");

would be a safe way to fix the issue on Jing's side, rather than asking users to suppress the warning in an ErrorReporter.

@michaelhkay
Copy link

Absolutely. The warning is telling you that there's no point setting the version to 2.0, because Saxon will use the default (3.0) regardless.

The only real point in requesting 2.0 would be to avoid accidentally using 3.0 features, in order to make sure that your code is portable to other 2.0 processors. But Saxon no longer provides that option.

@rdeltour
Copy link
Author

Ok, thanks for confirming, @michaelhkay!

rdeltour added a commit to rdeltour/jing-trang that referenced this issue Dec 12, 2022
Setting the "XSLT_VERSION" feature on Saxon's `TransformerFactory`
issued a warning on recent Saxon version (9.8+).

According to @michaelkay:

> At one time (before 3.0 was finalised) Saxon had the option to operate
> as either a 2.0 or a 3.0 conformant processor. If you selected 2.0 (in
> the API), then we tried hard to suppress all 3.0 features such as new
> functions, xsl:iterate, etc. Simply setting version="2.0" in the
> stylesheet doesn't have this effect (3.0 features will still work, so
> you don't pass the conformance tests for 2.0). At some later date we
> decided we would no longer have a 2.0-conformant mode: if you request
> 2.0, we fall back to 3.0, so you get the 3.0 features whether you like
> it or not. We made this decision because the level of backwards
> compatibility between 2.0 and 3.0 is very high, so pretty well all
> non-error stylesheets will run unchanged.

This commit removes the code setting the "XSLT_VERSION" feature.

Fix relaxng#277.
@rdeltour rdeltour linked a pull request Dec 12, 2022 that will close this issue
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 a pull request may close this issue.

3 participants