Project

Profile

Help

Bug #4725

closed

Saxon-JS 2 fails to compile XSLT stylesheet giving error "Required cardinality of value of parameter $static-base-uri is exactly one; supplied value is empty"

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

Status:
Closed
Priority:
Low
Category:
XX compiler
Sprint/Milestone:
-
Start date:
2020-09-05
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

When trying to reduce a stylesheet to identify the cause of a problem in Saxon Java I run into a problem with a stylesheet that compiles with Saxon EE 10.2 Java and is executable then with Saxon JS 2 under Node and xslt3 but which xslt3 can't compile, giving an error

Failed to compile stylesheet: Required cardinality of value of parameter $static-base-uri is exactly one; supplied value is empty Error XTTE0590 at xpath.xsl#628 Failed to compile stylesheet Error XTTE0590 at xpath.xsl#628 Required cardinality of value of parameter $static-base-uri is exactly one; supplied value is empty

The sample code is not very meaningful as it was just meant to identify where Saxon Java knows or does not know about the $value variable in an xsl:accumulator-rule:

<?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:accumulator name="iterate-value-test" as="xs:integer" initial-value="0">
        <xsl:accumulator-rule match="foo">
            <xsl:variable name="test" select="$value"/>
            <xsl:sequence select="$test + 1"/>
        </xsl:accumulator-rule>
    </xsl:accumulator>
    
    <xsl:mode on-no-match="shallow-copy" use-accumulators="iterate-value-test"/>
    
    <xsl:template match="foo">
        <xsl:copy>
            <xsl:attribute name="accumulator-test" select="accumulator-before('iterate-value-test')"/>
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="/" name="xsl:initial-template">
        <xsl:next-match/>
        <xsl:comment xmlns:saxon="http://saxon.sf.net/">Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('Q{http://saxon.sf.net/}platform')}</xsl:comment>
    </xsl:template>
    
</xsl:stylesheet>

I am a bit lost as to where the static-base-uri problem is caused by but as the code compiles with Saxon EE Java I guess the Saxon JS compiler has a bug here.

Please register to edit this issue

Also available in: Atom PDF Tracking page