Project

Profile

Help

Bug #5198

closed

NodeJS run from command-line with '-it:main' arg results in error when using mode="#current"

Added by Philip Fearon almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2022-01-08
Due date:
% Done:

100%

Estimated time:
Applies to JS Branch:
2
Fix Committed on JS Branch:
2
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

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.


Files

test.xsl (1.18 KB) test.xsl stylesheet Philip Fearon, 2022-01-08 11:29
input.xml (64 Bytes) input.xml xml source Philip Fearon, 2022-01-08 11:29
Actions #1

Updated by Martin Honnen almost 3 years ago

I think it is the mode="#current" that lets Saxon-JS struggle, use no mode attribute on the apply-templates or mode="#default" as a workaround.

Actions #2

Updated by Michael Kay over 2 years 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.

Actions #3

Updated by Michael Kay over 2 years ago

  • Subject changed from NodeJS run from command-line with '-it:main' arg results in error when using specific XSLT to NodeJS run from command-line with '-it:main' arg results in error when using mode="#current"
Actions #4

Updated by Debbie Lockett over 2 years ago

  • Fix Committed on JS Branch 2 added
  • Fix Committed on JS Branch deleted (Trunk)
Actions #5

Updated by Debbie Lockett over 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in JS Release set to SaxonJS 2.4

Bug fix applied in the SaxonJS 2.4 maintenance release.

Please register to edit this issue

Also available in: Atom PDF Tracking page