Skip to content

Low hanging fruits#125

Merged
faassen merged 2 commits intoPaligo:mainfrom
bojidar-bg:low-hanging-fruits
Jan 5, 2026
Merged

Low hanging fruits#125
faassen merged 2 commits intoPaligo:mainfrom
bojidar-bg:low-hanging-fruits

Conversation

@bojidar-bg
Copy link
Contributor

After my work in #124, I was about to head back to xsl:param-s, when I noticed that the top error was actually "No stylesheet found" and not something about params. Upon investigation, I found that this was due to missing support for stylesheets defined in the environment in the test runner.

Sadly, this did not lead to any new tests getting magically solved, because virtually all test cases using environment stylesheets use params to control the behavior of the repeated stylesheet.

At that point, the output of the error-sorting pipeline from #124 (cargo run --release --bin xee-testrunner -- -v all vendor/xslt-tests/ | cut -sd' ' -f3- | cut -d'(' -f-2 | sort | uniq -c | sort -h), looked like the following:

...
   1098 PASS
   2235 CONTEXT ITEM ERROR Error parsing stylesheet: Unsupported Failed parsing XSLT: Unsupported("Unsupported declaration: Param")
   2299 CONTEXT ITEM ERROR Error parsing stylesheet: Unsupported Failed parsing XSLT: Unsupported("Unsupported declaration: Variable")
   2587 CONTEXT ITEM ERROR Error parsing stylesheet: Unsupported Failed parsing XSLT: Unexpected { span: Span { start: 1, end: 14 } }

...Which led to me investigating what causes <xsl:template> parsing to fail. It turned out to be an issue with error reporting in the OrParser, where a <xsl:template> match failing due to unsupported XSLT features then got retried as a <xsl:stylesheet> match, which failed with an unhelpful error pointing at the root element. In the second commit, I touched up the OrParser so it would return the error from the first match in case the second match error is "Unexpected".

And now, the output of the error-sorting pipeline finally looks like this:

...
    509 CONTEXT ITEM ERROR Error parsing stylesheet: Unsupported Named templates not supported
    548 CONTEXT ITEM ERROR Error parsing stylesheet: Unsupported Failed parsing XSLT: Unsupported("Unsupported declaration: ImportSchema")
   1098 PASS
   3038 CONTEXT ITEM ERROR Error parsing stylesheet: Unsupported Failed parsing XSLT: Unsupported("Unsupported declaration: Variable")
   4437 CONTEXT ITEM ERROR Error parsing stylesheet: Unsupported Failed parsing XSLT: Unsupported("Unsupported declaration: Param")

Now clearly, xsl:param declarations are the XSLT feature that causes the most tests to fail. 😂

No longer is "No stylesheet found" the top error message!
Curiously, all tests using environment-defined stylesheet also use another unsupported XSLT feature, meaning we gain a net total of 0 newly-working tests. Pity!
1. When getting an Unexpected error from the second part of an OrParser, surface the original error from the first part as it's more likely to be useful for debugging. (In theory, we need an aggregated error listing both parts to fully capture the error)
2. When getting an Unexpected error from parsing the XSLT, print out the offending piece of XSLT code
@faassen faassen merged commit 122a29f into Paligo:main Jan 5, 2026
1 check passed
@github-actions github-actions bot mentioned this pull request Jan 5, 2026
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.

2 participants