Project

Profile

Help

Bug #4391

closed

Cannot find a 0-argument function named {http://saxonica.com/ns/interactiveXSLT}page()

Added by David Priest about 5 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT export
Sprint/Milestone:
-
Start date:
2019-11-22
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.8, 9.9, trunk
Fix Committed on Branch:
10, 9.9, trunk
Fixed in Maintenance Release:
Platforms:

Description

Using XML Editor 21.1, build 2019101513 and its in-menu Tools > Compile XSL Stylesheet for Saxon... command.

About > Libraries claims Saxon EE 9.8.0.12.

In preview the following XML code seems to be partially eaten by the render engine, so I've also attached them as files.

File 1: root.xsl

<xsl:transform
	expand-text="yes"
	extension-element-prefixes="ixsl"
	version="3.0"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT"
	xmlns:rh="urn:publicid:rh"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:use-package
		name="urn:publicid:rh:second">
		<xsl:override>
			<xsl:template
				match="html/head/title"
				mode="rh:init">
				<xsl:result-document
					href="?."
					method="ixsl:replace-content">Root Title</xsl:result-document>
			</xsl:template>
		</xsl:override>
	</xsl:use-package>
</xsl:transform>

File 2: second.xsl

<xsl:package
	expand-text="yes"
	extension-element-prefixes="ixsl"
	name="urn:publicid:rh:second"
	package-version="1.0.0"
	version="3.0"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT"
	xmlns:rh="urn:publicid:rh"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:mode
		name="rh:init"
		visibility="public" />

	<xsl:template
		name="xsl:initial-template"
		visibility="public">
		<xsl:message>start xsl:initial-template</xsl:message>
		<xsl:apply-templates
			mode="rh:init"
			select="ixsl:page()" />
		<xsl:message>exit xsl:initial-template</xsl:message>
	</xsl:template>

	<xsl:template
		match="html/head/title"
		mode="rh:init">
		<xsl:result-document
			href="?."
			method="ixsl:replace-content">Second Title</xsl:result-document>
	</xsl:template>

</xsl:package>

File 3: saxon.conf.xml:

<configuration
	edition="EE"
	label="SaxonJSUI"
	xmlns="http://saxon.sf.net/ns/configuration">
	<xsltPackages>
		<package
			name="urn:publicid:rh:second"
			sourceLocation="file:/ ...elided... /rh.library/xsl/second.xsl"
			version="1.0.0" />
	</xsltPackages>
</configuration>

On compiling root.xsl, I get the error Cannot find a 0-argument function named {http://saxonica.com/ns/interactiveXSLT}page()

Installing the Saxon 9.9 add-on and using the toolbar Compile XSLT Saxon 9.9 does, however, succeed.


Files

root.xsl (610 Bytes) root.xsl placed in one directory David Priest, 2019-11-22 01:29
second.xsl (824 Bytes) second.xsl placed in a different directory David Priest, 2019-11-22 01:30
saxon.conf.xml (280 Bytes) saxon.conf.xml update the file path before using David Priest, 2019-11-22 01:30
Actions #1

Updated by David Priest about 5 years ago

If you can edit the description, I suspect adding blank lines above/below the triple-tilde markers might fix the render issue.

Actions #2

Updated by Michael Kay about 5 years ago

  • Description updated (diff)
Actions #3

Updated by Debbie Lockett about 5 years ago

Rather than compiling within Oxygen, I've run some tests to compile the supplied files from the command line. e.g. using:

-nogo
-target:JS
-xsl:root.xsl
-config:saxon.conf.xml
--generateByteCode:off
-export:root.sef
-t
-relocate:on

I actually see the "Cannot find a 0-argument function named {http://saxonica.com/ns/interactiveXSLT}page()" error on both the 9.8 and 9.9 branches.

It looks like the target edition is not correctly set to "JS" when compiling the second stylesheet package, and so the IXSLFunctionSet library is not included.

Actions #4

Updated by Michael Kay about 5 years ago

  • Project changed from SaxonJS to Saxon
  • Category set to XSLT export
  • Status changed from New to In Progress
  • Assignee set to Michael Kay
  • Priority changed from Low to Normal
  • Applies to branch 9.8, 9.9, trunk added
Actions #5

Updated by Michael Kay about 5 years ago

Looks awkward: the library package is compiled in the course of building the Configuration from the configuration file; the configuration file contains no attribute to control the "target" form of the compiled SEF, and there is no easy way of getting in the value of "target" supplied on the command line. Hence we use a default target of "HE", and therefore the IXSLT function library is not included in the static context for compilation.

Found a cheap and dirty fix, relying on the fact that the library package is only compiled lazily (when referenced), so we can set the target edition of the compilerInfo in the PackageLibrary at this point. A better solution would be to allow the target to be specified in the configuration file.

Actions #6

Updated by Debbie Lockett about 5 years ago

  • Fix Committed on Branch 9.9, trunk added

Fix committed on 9.9 and trunk branches, as described above. (i.e. In Compilation.satisfyPackageDependencies(), set the target edition for the PackageLibrary from the target edition of the Compilation's compilerInfo.)

Leaving the bug open, because the patch is inelegant!

Actions #7

Updated by Michael Kay over 4 years ago

Adding an attribute targetEdition="JS" to the configuration element of the configuration file, to provide a cleaner solution.

The code changes to the ConfigurationReader are very simple - most of the work is in changing the schema, documentation, and test cases.

Actions #8

Updated by Michael Kay over 4 years ago

  • Status changed from In Progress to Resolved
  • Fix Committed on Branch 10 added

For the 10.0 branch only, the ConfigurationReader now accepts attribute targetEdition="JS" on the <configuration> element. The schema in samples/config.xsd has been updated accordingly.

Actions #9

Updated by O'Neil Delpratt over 4 years ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.1 added

Bug fix committed in the Saxon 10.1 maintenance release.

Actions #10

Updated by O'Neil Delpratt about 4 years ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 10.2, 9.9.1.8 added
  • Fixed in Maintenance Release deleted (10.1)

Bug fix applied on the Saxon 9.9.1.8 maintenance release.

Please register to edit this issue

Also available in: Atom PDF