Project

Profile

Help

Bug #6416

closed

Documentation says saxon:compile-query and saxon:query are not available in SaxonCS but SaxonCS 12.4 seems to support them

Added by Martin Honnen 12 days ago. Updated 11 days ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Documentation
Sprint/Milestone:
-
Start date:
2024-05-07
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:
Platforms:
.NET

Description

https://www.saxonica.com/html/documentation12/functions/saxon/compile-query.html says

Saxon availability Requires Saxon-PE or Saxon-EE. Available for Java and C/C++ only (not .NET).

Notes on the Saxon implementation Available since Saxon 9.0. Not available in SaxonCS.

and https://www.saxonica.com/html/documentation12/functions/saxon/query.html says

Saxon availability Requires Saxon-PE or Saxon-EE. Available for Java and C/C++ only (not .NET).

Notes on the Saxon implementation Available since Saxon 9.1. The function is available both in XQuery and in XSLT. Not available in SaxonCS.

but for me SaxonCS 12.4 runs an example like

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

  <xsl:param name="xquery-param1" as="xs:string" expand-text="no"><![CDATA[
  declare variable $x external; declare variable $y external; <z>{$x + $y + .}</z>
  ]]></xsl:param>

  <xsl:output indent="yes"/>

  <xsl:template match="/" name="xsl:initial-template">
    <result>
      <xsl:variable name="xquery1" select="saxon:compile-query($xquery-param1)"/>
      <xsl:variable name="xquery1-params" as="element()*">
         <x>3</x>
         <y>2</y>
      </xsl:variable>
      <xsl:sequence select="saxon:query($xquery1,4, $xquery1-params)"/>
    </result>
  </xsl:template>

</xsl:stylesheet>

without any problems.

Is the documentation not up to date or is SaxonCS 12 not supposed to support those two extension functions?

Actions #1

Updated by Michael Kay 11 days ago

I've tried running our test cases for saxon:compile-query() and saxon:query() under SaxonCS and some of them fail, so I think the exclusion was deliberate.

Looking at it more carefully, the tests that fail are those that explicitly declare the result type of saxon:compile-query as java:net.sf.saxon.query.XQueryExpression; SaxonCS doesn't recognize that type.

So it's not a particularly big issue; but at the same time, the solution isn't obvious.

Ideally, for the modern age, I would prefer to redesign this extension to work like fn:invisible-xml() - have the compile-query return a function item that can be executed with parameters to evaluate the query. And indeed, we should try to make that a standard 4.0 function.

Actions #2

Updated by Michael Kay 11 days ago

  • Status changed from New to In Progress

I think for the time being I'll go with documenting that these functions work under SaxonCS with known restrictions.

Actions #3

Updated by Michael Kay 11 days ago

I overlooked that since Saxon 11 we have supported saxon:xquery(), which implements the suggested design of returning a function item to evaluate the query.

So: change of plan. We will change the documentation to mark the old functions as obsolescent, and refer readers more clearly to saxon:xquery() as the preferred replacement.

Actions #4

Updated by Michael Kay 11 days ago

  • Status changed from In Progress to Resolved
  • Applies to branch trunk added
  • Fix Committed on Branch 12, trunk added

Please register to edit this issue

Also available in: Atom PDF