Project

Profile

Help

Bug #6579

closed

In SEF file reference to extension function fails

Added by Joel Kalvesmaki 17 days ago. Updated 16 days ago.

Status:
Resolved
Priority:
Low
Assignee:
Category:
XSLT export
Sprint/Milestone:
-
Start date:
2024-11-07
Due date:
% Done:

0%

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

Description

I converted a simple XSLT file (attached) to an SEF file (attached) by Saxon-CS 11.5 on the command line. The XSLT has various references/uses of the file function library. When I run that SEF file, I get the following error message.

jkalvesmaki@LAPD08B4G3 MINGW64 /d/saxon/SaxonCS-11.5
$ ./SaxonCS transform -s:xslt-test.xsl -xsl:xslt-test.sef -o:output.xml         Error
  SXPK0002  Unknown system function Q{http://expath.org/ns/file}last-modified#1
Unknown system function Q{http://expath.org/ns/file}last-modified#1
Exiting with code 2

The error disappears when I comment out the last line of code in the XSLT file:

<xsl:comment>uris sorted {sort((base-uri(/), static-base-uri()), (), file:last-modified#1)}</xsl:comment>

So file:last-modified is okay when used directly (see lines 13, 15), but not in references.

It's unclear to me whether this is a bug, or actually a feature, because of the nature of function references. If the latter, I don't think there's much documentation to help programmers stay away from function references in code that will be deployed in SEF files. Perhaps provide a note at https://www.saxonica.com/documentation12/index.html#!using-xsl/compiling ?


Files

xslt-test.sef (4.33 KB) xslt-test.sef Source XSLT, compiled with Saxon-CE 11.5 Joel Kalvesmaki, 2024-11-07 02:53
xslt-test.xsl (1009 Bytes) xslt-test.xsl Source XSLT Joel Kalvesmaki, 2024-11-07 02:53
Actions #1

Updated by Michael Kay 16 days ago

  • Category set to XSLT export
  • Status changed from New to In Progress
  • Assignee set to Michael Kay

Problem reproduced with SaxonJ 12.x.

There are indeed some limitations with exporting function items to SEF files, and they aren't well documented, but there is no reason for a limitation here. The SEF tag "fnRef" is generated for any reference to a "system function". The EXPath file and binary libraries are implemented as system functions (not as extension functions), but the code for importing system functions only handles the namespaces fn, math, map, array, and saxon.

So there's simply a gap here in the implementation. And a corresponding gap in the test coverage - we rely rather on the EXPath test suite for these libraries, which invokes them only from XPath, not from XSLT, which means that export/import doesn't get tested.

Actions #2

Updated by Michael Kay 16 days ago

Fixed on the 12.x branch.

Test cases for calls to the Expath bin and file modules added to the xslt3extra tests.

Actions #3

Updated by Michael Kay 16 days ago

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

Please register to edit this issue

Also available in: Atom PDF