Project

Profile

Help

Bug #4238

In Saxon-EE, element-available() always returns true for IXSL extension elements

Added by Debbie Lockett 3 months ago. Updated 13 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2019-06-18
Due date:
% Done:

0%

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

Description

The result of element-available() should depend on the target edition. e.g. element-available('ixsl:schedule-action') should return true when exporting for Saxon-JS, but not otherwise.

Note that ElementAvailable.isElementAvailable() takes the target edition into account for elements in the XSLT namespace, but apparently not otherwise. (But this should also be reviewed - the list of XSLT elements allowed by isSaxonJSElement doesn't look right.)

If a stylesheet containing an IXSLT extension element is run in Saxon-EE, then this results in a run-time error ("ixsl:schedule-action is available only in Saxon-JS", with no error code), rather than a compile-time error.

History

#1 Updated by Michael Kay about 2 months ago

  • Fix Committed on Branch 9.9, trunk added

On the development branch, I have updated the list of XSLT elements available in Saxon-JS to include all except accept, expose, import-schema, override, package, and use-package.

I noticed that the code is not handling an EQName of the form Q{uri}local in the case where the URI contains a colon. Fixed this on 9.9 and trunk; added XSLT30 test case function-0303.

#2 Updated by Michael Kay about 2 months ago

In looking for test cases I found that we actually have a partial implementation of the IXSL function library that invokes Nashorn to execute Javascript when running Saxon under Java. It's a very partial implementation and can only handle simple cases, because the Javascript<->XPath type conversion hasn't been thought through - it only works for simple cases like computing a string or integer. Making this useful would require a lot more development and testing and I'm not going to attempt that right now.

I think that function-available() should therefore return false for these functions unless the target environment is JS. If the compilation target is JS but execution takes place on the Java platform, execution of the function should fail cleanly.

I've been adding some tests for function-available in jstests/IxslExtensionTest; will come back to element-available() later.

#3 Updated by Michael Kay 13 days ago

Looking back at comment #1, I'm not sure why I excluded package-related elements like xsl:accept and xsl:override from the Saxon-JS list. These elements are not currently handled by the new XX compiler, but they should work perfectly well when compiling a stylesheet for Saxon-JS using the Saxon-EE compiler.

Please register to edit this issue

Also available in: Atom PDF