Project

Profile

Help

Bug #5540

closed

Namespace context should be reset at the beginning of an XSLT stylesheet

Added by Norm Tovey-Walsh over 2 years ago. Updated about 1 month ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
-
Sprint/Milestone:
Start date:
2022-05-26
Due date:
% Done:

100%

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

Description

Martin Honnen reports that the following transformation works successfully in SaxonJS:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="3.0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  exclude-result-prefixes="#all"
  expand-text="yes">


  <xsl:template match="/" name="xsl:initial-template">
    <xsl:comment>Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('Q{http://saxon.sf.net/}platform')}</xsl:comment>
    <test>{fn:current-dateTime()}</test>
  </xsl:template>
  
</xsl:stylesheet>

If you run fn:transform() through SaxonJS.XPath.evaluate. Note also that the documentation for XPath.evaluate says "For convenience the usual namespaces for prefixes xml, fn, xs, map, array, math, and saxon are defined by default, but can be overwritten."

It appears that the namespace context of XPath.evaluate "leaks" into the transformation allowing the undeclared use of "fn:".

Please register to edit this issue

Also available in: Atom PDF Tracking page