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

SXWN9000 for text node rule #11

Closed
AirQuick opened this issue Dec 14, 2018 · 6 comments
Closed

SXWN9000 for text node rule #11

AirQuick opened this issue Dec 14, 2018 · 6 comments

Comments

@AirQuick
Copy link
Contributor

When I have a rule on text

<sch:rule context="text()">

then the compiled stylesheet generates a warning

Warning at char 7 in xsl:apply-templates/@select on line 142 column 66 of stage-3.xsl:
  SXWN9000: The child axis starting at a text node will never select anything
Warning at char 11 in xsl:apply-templates/@select on line 142 column 66 of stage-3.xsl:
  SXWN9000: The attribute axis starting at a text node will never select anything

Could this be avoided?

Using Saxon 9.9.0.2.

@AirQuick
Copy link
Contributor Author

Replacing https://github.com/dmj/schxslt/blob/086a08182532eac7376dceaf191c3046bf498542/src/xslt/compile.xsl#L258
with something like

          <call-template name="schxslt:handle-attr-and-children"/>

and relocating xsl:apply-templates into that named template might work in this particular case, although ugly...
Just my quick thought.

@dmj
Copy link
Member

dmj commented Dec 17, 2018

This curently works, indeed. But I don't think that this is a viable solution: Saxon issues the warning during static analysis. It might be just a matter of time until Saxon catches up.

Maybe suppressing Saxon warnings alltogether is an option?

If not, we could utilize ​@‍use-when and create different paths depedning on the xsl:vendor system property. But this should be the last resort.

@dmj dmj added this to the Final Release 1.0 milestone Dec 17, 2018
@dmj
Copy link
Member

dmj commented Dec 17, 2018

Addendum: With queryBinding xslt3 the solution would be xsl:mode on-no-match=shallow-skip. I currently need the apply-templates call b/c the built-in template rule for elements ignores the attribute axis.

@dmj
Copy link
Member

dmj commented Dec 17, 2018

No, this is not true. Still need to apply to @‍* when an element has matched.

@AirQuick
Copy link
Contributor Author

Right, the viability depends entirely on Saxon's evolution.
I don't know what the best solution would be... In general I would hesitate to suppress warnings, for fear of overlooking helpful ones.

@dmj
Copy link
Member

dmj commented Dec 23, 2018

This problem is solved: SchXslt now uses "ex-post rule match selection" by default. I.e.: The validation stylesheet chains rule templates with xsl:next-match.

@dmj dmj closed this as completed Dec 23, 2018
dmj added a commit that referenced this issue May 12, 2020
…lt-schxslt-1.4.5

Bump schxslt from 1.4.2 to 1.4.5
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

No branches or pull requests

2 participants