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 over 4 years ago. Updated almost 4 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.

Actions #1

Updated by John Lumley over 4 years 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

Actions #2

Updated by Debbie Lockett over 4 years ago

  • Assignee set to Debbie Lockett
Actions #3

Updated by Michael Kay over 4 years ago

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

Actions #4

Updated by Debbie Lockett about 4 years 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)" )

Actions #5

Updated by Community Admin almost 4 years ago

  • Applies to JS Branch 2 added
  • Applies to JS Branch deleted (2.0)
Actions #6

Updated by Community Admin almost 4 years ago

  • Fix Committed on JS Branch 2 added
  • Fix Committed on JS Branch deleted (2.0)
Actions #7

Updated by Debbie Lockett almost 4 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in JS Release set to Saxon-JS 2.1

Bug fix applied in the Saxon-JS 2.1 maintenance release.

Please register to edit this issue

Also available in: Atom PDF Tracking page