Project

Profile

Help

Bug #4725

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 20 days ago. Updated 2 days ago.

Status:
Resolved
Priority:
Low
Category:
XX compiler
Sprint/Milestone:
-
Start date:
2020-09-05
Due date:
% Done:

0%

Estimated time:
Applies to JS Branch:
2.0
Fix Committed on JS Branch:
2.0
Fixed in JS Release:
SEF Generated with:
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.

History

#1 Updated by John Lumley 10 days ago

The problem arises because the xsl:accumulator is not having its baseURI recorded in the the 'SEF' compiling phase, whilst it has been preserved during static and normalisation phases. Needs an effective baseUri="{@ex:baseUri}" added to the compile step at streaming.xsl#72

#2 Updated by Debbie Lockett 9 days ago

  • Assignee set to Debbie Lockett

#3 Updated by Michael Kay 9 days ago

Added test case accumulator-086. For some reason the Saxon-JS test driver isn't running it, saying "Dependency not satisfied (A)".

#4 Updated by Debbie Lockett 2 days ago

  • Status changed from New to Resolved
  • Fix Committed on JS Branch 2.0 added

Patch committed in XXcompiler/instr/streaming.xsl#34.

(accumulator-086 now passes. It runs fine for me, I don't see "Dependency not satisfied (A)" )

Please register to edit this issue

Also available in: Atom PDF Tracking page