Project

Profile

Help

Bug #5916

open

Using xsl:merge with xsl:merge-source for-each-source="'input1.xml'" select="some-xpath" gives error XPDY0002 "Focus for / is absent"

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

Status:
New
Priority:
Normal
Assignee:
-
Category:
XSLT Conformance
Sprint/Milestone:
Start date:
2023-03-12
Due date:
% Done:

0%

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

Description

I have tried to run an XSLT 3 example using XSLT 3's new xsl:merge through SaxonJS 2.5's xslt3 command line tool under Windows 11 with Node 16, a simple example using e.g.

  <xsl:template name="xsl:initial-template">
      <list>
         <xsl:merge>
            <xsl:merge-source name="master" for-each-source="'input1.xml'" sort-before-merge="yes" select="/list/item">
               <xsl:merge-key select="@id" order="ascending"/>
            </xsl:merge-source>

gives an error

Transformation failure: Error XPDY0002 at sheet1.xsl#7
  Focus for / is absent
Error XPDY0002 at sheet1.xsl#7
  Focus for / is absent

The code runs fine through Saxon HE 11.5 Java.

Full files attached; command line xslt3 -t -it -xsl:sheet1.xsl gives output

SaxonJS 2.5 from Saxonica
Node.js version v16.17.1
Compiling stylesheet C:\Users\marti\OneDrive\Documents\xslt\blog-xslt-3-by-example\nested-merge\sheet1.xsl
Stylesheet compilation time: 0.342s
Initial template: Q{http://www.w3.org/1999/XSL/Transform}initial-template
Asynchronous transform with options: stylesheetText={"N":"package","version":"30",(string), stylesheetBaseURI=file://C:/Users/marti/OneDrive(string), stylesheetParams=[object Object](string), outputProperties=[object Object](string), extraOptions=[object Object](string), destination=stdout(string), baseOutputURI=file://C:/Users/marti/OneDrive(string), logLevel=2(string), initialTemplate=Q{http://www.w3.org/1999/XSL/T(string),
SEF generated by SaxonJS 2.5 at 2023-03-12T13:32:13.485+01:00
Transformation failure: Error XPDY0002 at sheet1.xsl#7
  Focus for / is absent
Error XPDY0002 at sheet1.xsl#7
  Focus for / is absent

Files

input1.xml (269 Bytes) input1.xml Martin Honnen, 2023-03-12 13:39
input2.xml (225 Bytes) input2.xml Martin Honnen, 2023-03-12 13:39
sheet1.xsl (3.18 KB) sheet1.xsl Martin Honnen, 2023-03-12 13:39
signature.asc (833 Bytes) signature.asc John Lumley, 2023-03-12 19:27
Actions #1

Updated by Martin Honnen 11 days ago

Seems a documented issue/restriction, the documentation states xsl:merge: The xsl:for-each-source attribute is not implemented.. Too bad, kind of used by now to run nearly any XSLT 3 through SaxonJ or CS or JS, expecting full support (other than packages and schema awareness).

Actions #2

Updated by Martin Honnen 11 days ago

Using <xsl:merge-source name="master" sort-before-merge="yes" select="doc('input1.xml')/list/item"> seems a workaround.

Actions #3

Updated by Martin Honnen 11 days ago

Wiil for-each-source be supported in SaxonJS 3?

Actions #4

Updated by Norm Tovey-Walsh 11 days ago

I can't say off the top of my head, but creating this bug has no doubt improved the chances!

Actions #5

Updated by John Lumley 11 days ago

Could be an interesting problem to make it asynchronous…..

Sent from my iPad

On 12 Mar 2023, at 18:21, Saxonica Developer Community wrote:



Please register to edit this issue

Also available in: Atom PDF Tracking page