Project

Profile

Help

Bug #4619

XX Compiler fails to compile stylesheet containing static parameters

Added by Michael Kay 15 days ago. Updated 14 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
XX compiler
Sprint/Milestone:
-
Start date:
2020-06-28
Due date:
% Done:

0%

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

History

#1 Updated by John Lumley 15 days ago

This is a puzzle... certainly there are cases of the XX compiler compiling the testdriver successfully - and that certainly contains static parameters used for conditional compilation.

Sent from my iPad

On 28 Jun 2020, at 15:18, Saxonica Developer Community wrote:



#2 Updated by John Lumley 14 days ago

  • Status changed from New to In Progress
  • Applies to JS Branch Trunk added

A minimal reproduction of the problem occurs with:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="#all" version="3.0">

   <xsl:param name="xslt-uri" static="yes" as="xs:string?" select="'group-sales-sum-product.xsl'"/>

</xsl:stylesheet>

which fails in the static phase with as="xs:string?" but succeeds with as="xs:string"

#3 Updated by John Lumley 14 days ago

The strategy for handling type declarations on such static variables has been to wrap the expression in a casting function, for example:

<xsl:param name="length" as="xs:decimal" select="12+34"/>

involves an evaluation of the XPath expression 'xs:decimal(12+34)'. Unfortunately this has never been tried with a cardinality indicator, so the compiler has been trying to parse

xs:string?(.....)

which on encountering the ? operator, assumes a lookup and takes the left hand operator to be a child::xs:string term. In this case there is no context focus and hence the error.

#4 Updated by John Lumley 14 days ago

Patch committed, though there may be need to implement function conversion rules as a final solution

Please register to edit this issue

Also available in: Atom PDF Tracking page