Bug #3689

Problem with apply-templates in "#current" mode

Added by Debbie Lockett about 2 years ago. Updated almost 2 years ago.

Start date:
Due date:
% Done:


Applies to JS Branch:
1.0, Trunk
Fix Committed on JS Branch:
1.0, Trunk
Fixed in JS Release:
SEF Generated with:
Contact person:
Additional contact persons:


For apply templates in current mode, the current component for the new context is not being set. This can result in internal errors.

Problem raised in forum issue: - Error XError, message: "Internal error: Target component not found at htmlparse.xsl#423", code: "SXJS0004" when trying to use David Carlisle's XSLT 2.0 implementation of an HTML parser from Saxon-JS


#1 Updated by Michael Kay about 2 years ago

Note, I think the only case where you can do xsl:apply-templates mode="current" and the current component is not already the same as the current mode is where you are in a named template (current mode survives a call to a named template). If you're in a template rule then the current component is the same as the current mode; in all other cases, the current mode is absent.

#2 Updated by Debbie Lockett about 2 years ago

  • Status changed from New to Resolved
  • Fix Committed on JS Branch 1.0, Trunk added

Add code in applyT implementation in Expr.js (line #75):

c2.currentComponent = context.currentMode

Committed on 1.0 and trunk branches.

#3 Updated by Debbie Lockett almost 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in JS Release set to Saxon-JS 1.1.0

Bug fix applied in the Saxon-JS 1.1.0 maintenance release.

Please register to edit this issue

Also available in: Atom PDF Tracking page