xspec: Coverage XML file is not well-formed (ends mid-element)
With Saxon EE 12.5 running on the command line and today’s XSpec (2025-02-10; XSpec apparently does not report its version, but the pom says “3.2-SNAPSHOT”) I processed two XSpec files with coverage (-c). One completed successful and generated a coverage report with no highlighting; I don’t know whether I should have expected highlighting.
I’m opening an issue because the other one aborted the output coverage XML file mid-line (line 732):
<hit lin
The XSpec tests all complete successfully; the error appears only with the coverage report. I’d be happy to provide copies of the files, which are not large, if that would be helpful, but I didn’t want to clutter this report if it involves a known issue.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (8 by maintainers)
Commits related to this issue
- Add test for issue 2071 These files were created by birdya22 and delivered in the ZIP-file linked from https: //github.com/xspec/xspec/issues/2071#issuecomment-2669271632 Co-Authored-By: birdya22 <1... — committed to galtm/xspec by galtm 2 years ago
- Exclude test until 2071 is fixed To make this XSpec test run, someone needs to undo this commit after #2071 is fixed. — committed to galtm/xspec by galtm 2 years ago
- test(xslt): end-to-end coverage test for issue 2071 (#2084) * Add test for issue 2071 These files were created by birdya22 and delivered in the ZIP-file linked from https: //github.com/xspec/xspec/... — committed to xspec/xspec by galtm 2 years ago
- fix(report): coverage of package-related elements Changes in XSLT for code coverage, written by user birdya22. From ZIP-file at https://github.com/xspec/xspec/issues/2082#issuecomment-2706176548 Sup... — committed to galtm/xspec by galtm 2 years ago
- fix(report): code coverage support for explicit XSLT packages (#2099) * fix(report): coverage of package-related elements Changes in XSLT for code coverage, written by user birdya22. From ZIP-file a... — committed to xspec/xspec by galtm 2 years ago
I’ve had a quick look and it seems that the issue has been fixed for XSpec, but I want to do some more investigation. I intend to create a Saxon 12.6 issue here to document my findings for the issue and other things related to Code Coverage.
The problem with the previous attempt was that if ‘transform’ called a ‘template’ which called a ‘function’ then I reduced the open() count, and shouldn’t have.
The updated logic for the fix would be (2nd line is new):
When ‘<call expr=“fn:transform(…)”’ happens, set a flag to indicate a possible issue. When ‘<xsl:template’ happens unset the flag, as this doesn’t lead to the issue . When ‘<xsl:function’ happens, update the flag if it is set, to indicate an actual issue. When ‘</call’ happens, if flag is updated then reduce the open() count. Reset the flag in all cases.
I’ve done an update to the Trace Listener.
XSLTCoverageTraceListener.java.txt
I see that Saxonica have fixed and closed the issue raised on them, and are also saying that Saxon 12.6 is due for release soon.