Getting error XPST0017 when importing XSLT file

Viewed 57

I can successfully run an XSLT transformation with stylesheet A. When I import stylesheet A into stylesheet B, I get the following error:

[2022-07-30 19:54:59]
C:\Users\dschiavon\Downloads\Customers\Customer\2007\saxon.log
Transformation filename:
web-extend.xslt
Input path:
C:\Users\dschiavon\Downloads\Customers\Customer\2007\information security policy.xml
Output path:
C:\Users\dschiavon\Downloads\Customers\Customer\2007\information security policy.xml
Transform.exe : Saxon-HE 9.7.0.7N from Saxonica
At C:\Users\dschiavon\Downloads\saxon_transform\saxon_transform.ps1:45 char:1
+ & $saxon -s:"$inputPath" -xsl:"$publish_folder\$transformation_filena ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Saxon-HE 9.7.0.7N from Saxonica:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
.NET 4.0.30319.42000 on Microsoft Windows NT 6.2.9200.0
URIResolver.resolve href="file:/C:/Users/dschiavon/Downloads/Customers/Customer/2007/web-extend.xslt" base="null"
Using parser org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser
URIResolver.resolve href="file:/C:/Users/dschiavon/Downloads/Customers/Customer/XSLT/Web.xslt" 
base="file:/C:/Users/dschiavon/Downloads/Customers/Customer/2007/web-extend.xslt"
Using parser org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser
URIResolver.resolve href="file:/C:/Users/dschiavon/Downloads/Customers/Customer/XSLT/Web.xslt" 
base="file:/C:/Users/dschiavon/Downloads/Customers/Customer/2007/web-extend.xslt"
Static error in {fn:serialize($topicContent)} in expression in xsl:value-of/@select on line 4553 column 98 of Web.xslt:
  XPST0017: System function serialize#1 is not available with this host-language/version/license
Errors were reported during stylesheet compilation
Transformation finished, end of script. 

Stylesheet B does nothing except importing stylesheet A:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
    xmlns:ait="http://www.authorit.com/xml/authorit" 
    xmlns:saxon="http://saxon.sf.net/" 
    exclude-result-prefixes="xsl xs ait saxon xd" extension-element-prefixes="ait saxon"
    version="2.0">
    <xsl:import href="file:/C:/Users/dschiavon/Downloads/Customers/Customer/XSLT/Web.xslt" />
</xsl:stylesheet>

Stylesheet A is very long (6500 lines), but the line causing the problem is this one:

<xsl:attribute name="data-content"><xsl:value-of select="serialize($topicContent)"/></xsl:attribute>

Saxon documentation does say that serialize() is obsolescent, so I tried with fn:serialize(), but got the same error.

How do I get the transformation to complete without errors? I am running Saxon-HE 9.7.0.7N on Windows.

NOTE: I tried with Saxon-HE 10.5J and the transformation completes correctly, so the problem is only in the .NET version.

Possibly related to Saxon 9 HE, Java - Static errors, XTSE0210, XTSE0165, XPST0017.

1 Answers

fn:serialize() was a new function introduced in XSLT 3.0, whch was finalised in 2017.

Saxon 9.7 was released in November 2015, and included partial implementation of the draft XSLT 3.0 specification. The documentation for that release clearly states:

All XSLT 3.0 features require at least Saxon-PE. Schema-awareness, streaming, and packages require Saxon-EE.

XSLT 3.0 support must be explicitly enabled, for example by specifying version="3.0" in the stylesheet or by using the option -xsltversion:3.0 on the command line.

See https://www.saxonica.com/documentation9.7/index.html#!using-xsl/xslt30

If you want to use newer features of the language, you need to keep up to date with software releases. The current release is 11.4.

The function that's obsolescent is not fn:serialize(), but the earlier Saxon extension function saxon:serialize().

Related