Project

Profile

Help

Bug #4587

closed

use of undefined system property like system-property('product') gives Internal error: bad input to string constructor

Added by Martin Honnen almost 4 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2020-06-14
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

I accidentally used an undefined system property name product as the argument to system-property and that gives an internal error in Saxon-JS 2 while Saxon HE Java seems to simply output an empty string.

XSLT:

<?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:mode on-no-match="shallow-copy"/>
    
    <xsl:template match="/" name="xsl:initial-template">
        <xsl:next-match/>
        <xsl:comment>Run with {system-property('xsl:product')} {system-property('xsl:product-version')}</xsl:comment>
    </xsl:template>
    
</xsl:stylesheet>

Any XML input serves:

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <foo>bar</foo>
</root>

Run with xslt3 -xsl:sheet.xsl -s:sample.xml and gives output

<?xml version="1.0" encoding="UTF-8"?><root>
    <foo>bar</foo>
</root>Internal error: bad input to string constructor #undefined
Error
    at Object.a [as internalError] (C:\Users\foo\AppData\Roaming\npm\node_modules\xslt3\node_modules\saxon-js\SaxonJS2N.js:26:474)

with a lengthy stack trace.


Files

sample1.xml (73 Bytes) sample1.xml Martin Honnen, 2020-06-14 14:58
undefined-system-property-test1.xsl (525 Bytes) undefined-system-property-test1.xsl Martin Honnen, 2020-06-14 14:58

Please register to edit this issue

Also available in: Atom PDF Tracking page