Bug #5823


The implemented fn:slice function signature differs from the Saxonica docs and the specification

Added by Philip Fearon about 1 year ago. Updated about 1 year ago.

Start date:
Due date:
% Done:


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


Using the attached XSLT 4.0 - with extensions enabled - with SaxonJ 12.0 PE:

When running the attached XSLT (test.xsl) from the command-line against itself I get the following error:

Error in xsl:variable/@select on line 9 column 76 of test.xsl:
  XPTY0004  The required item type of the second argument of fn:slice() is map(*)
Errors were reported during stylesheet compilation
Further tests showed that fn:slice must have 2 arguments: item()* and map(*) - the Saxon 12 documentation (and the spec) however indicate 4 arguments can be supplied - with the last 3 optional: 

fn:slice($input as item()*, $start as xs:integer?, $end as xs:integer?, $step as xs:integer?) as item()*


test.xsl (489 Bytes) test.xsl simple repro Philip Fearon, 2023-01-16 16:33
Actions #1

Updated by Michael Kay about 1 year ago

Yes, the spec here is in flux and we should drop the function until it stabilises.

Actions #2

Updated by Michael Kay about 1 year ago

I think the fn:slice() implemented in 12.0 is actually a synonym of saxon:slice as described at!functions/saxon/slice

Actions #3

Updated by Michael Kay about 1 year ago

We discussed policy on keeping 12.x maintenance releases up to date with the changing 4.0 specs, and decided that the general approach should be to keep as close to the changing spec as possible regardless of compatibility issues.

Actions #4

Updated by Michael Kay about 1 year ago

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

The current implementation of fn:slice() is unusable (the signature expects a map as the second argument, while the code expects an integer or sequence of integers), so I am dropping the function from the product and the documentation.

Actions #5

Updated by O'Neil Delpratt about 1 year ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 12.1 added

Bug fix applied in the Saxon 12.1 maintenance release.

Please register to edit this issue

Also available in: Atom PDF