Project

Profile

Help

Bug #6318

closed

replace with curly braces in second argument gives error "Error FORX0002: Invalid XPath regular expression: '{' not allowed here"

Added by Martin Honnen 12 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
XPath Conformance
Sprint/Milestone:
-
Start date:
2024-01-15
Due date:
% Done:

100%

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

Description

The test case

<?xml version="1.0" encoding="utf-8"?>
<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">
    <test>
       <run-with>{system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('Q{http://saxon.sf.net/}platform')} at {current-dateTime()}</run-with>
       <result>replace('15/01/24', '(.{2})/(.{2})/(.{2})', '$3$2$1'): {replace('15/01/24', '(.{2})/(.{2})/(.{2})', '$3$2$1')}</result>
    </test>
  </xsl:template>
  
</xsl:stylesheet>

when run with SaxonJS 2.6 both in the browser and from Node.js gives an unexpected and in my view wrong error message Invalid XPath regular expression: '{' not allowed here.

Output from Node.js xslt3 -t -it command:

SaxonJS 2.6 from Saxonica
Node.js version v18.18.1
Compiling stylesheet C:\Users\marti\OneDrive\Documents\xslt\blog-xslt-3-by-example\replace-test-curly-braces\replace-curly-braces-test1.xsl
Stylesheet compilation time: 0.105s
Initial template: Q{http://www.w3.org/1999/XSL/Transform}initial-template
Asynchronous transform with options: stylesheetText={"N":"package","version":"30",(string), stylesheetBaseURI=file://C:/Users/marti/OneDrive(string), stylesheetParams=[object Object](string), outputProperties=[object Object](string), extraOptions=[object Object](string), destination=stdout(string), baseOutputURI=file://C:/Users/marti/OneDrive(string), logLevel=2(string), initialTemplate=Q{http://www.w3.org/1999/XSL/T(string),
SEF generated by SaxonJS 2.6 at 2024-01-15T11:47:32.329+01:00
<?xml version="1.0" encoding="UTF-8"?><test><run-with>SaxonJS 2.6 Node.js at 2024-01-15T11:47:32.383+01:00</run-with>Transformation failure: Error FORX0002 at replace-curly-braces-test1.xsl#9
  Invalid XPath regular expression: '{' not allowed here
Error FORX0002 at replace-curly-braces-test1.xsl#9
  Invalid XPath regular expression: '{' not allowed here

Saxon HE 12 Java runs the code just fine.

Please register to edit this issue

Also available in: Atom PDF Tracking page