NodeJS run from command-line with '-it:main' arg results in error when using mode="#current"
This fails with SaxonJS 2.3 but the same XSLT runs OK using the Java version of Saxon. Here is the SaxonJS standard output:
Saxon-JS 2.3 ==== Watch Variables ==== doc: books Transformation failure: TypeError: Cannot read properties of undefined (reading 'Ib') Cannot read properties of undefined (reading 'Ib') The terminal process "npx 'xslt3', '-xsl:/Users/philipf/video-demos/init-template/test.xsl', '-it:main', '-o:/Users/philipf/video-demos/init-template/xslt-out/result1.xml'" terminated with exit code: 2.
The input file 'input.xsl' and the stylesheet file 'test.xsl' are attached. The actual command-liine used is in the error message above.
I'm guessing that the xsl:for-each instruction in test.xsl is not setting the context item required by xsl:copy as one would expect.
Updated by Michael Kay over 1 year ago
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Applies to JS Branch 2 added
- Fix Committed on JS Branch Trunk added
The specification is not very explicit about what the initial value of "current mode" should be when a stylesheet is invoked using
call-template invocation. We're setting it to
absent, and this causes a failure when
apply-templates mode="#current" is used.
Overall, I think the intent is that the current mode should never be null/absent (see §5.3.4 "Clearing the current mode causes the current mode to be set to the default (unnamed) mode." - though that's itself ambiguous since the default mode and the unnamed mode are not the same thing.)
I've changed the code in transform.js so that the current mode in the context is set in the same way for call-template and call-function invocation as for apply-templates invocation, and the test case now passes.
Please register to edit this issue