Support #3750
closedxsl:evaluate can't see user defined function in xsl stylesheet
0%
Description
Hello,
we wrote a xslt 3.0 schema-aware stylesheet which constructs a function with a given signature from the input document, which contains the function body. It then applies the constructed function to other parts of the input document. The function definition is constructed as a string (concatenation of signature and body). We use xsl:evaluate to turn this string into a function.
Whe the function body contains a call to a function which is defined in the stylesheet, we observe different behavior in Oxygen 19.1 (SAXON EE 9.7.0.19) and Oxygen 20, bundled with Saxon EE 9.8.0.8. With Oxygen 19.1 it works, but with Oxygen 20 we get the error message:
Static error in XPath expression supplied to xsl:evaluate: Cannot find a 1-argument function named ...
I would think it's a bug, because section 5.3.1 of XSLT 3.0 Spec (initializing the static context) says that
The stylesheet functions defined in the containing package are part of the static context (as far as i understand this section).
I have provided a simple test case. It does work with Oxygen 19 and fails within Oxygen 20.
Sincerely,
Frank
Files
Updated by Michael Kay over 6 years ago
- Status changed from New to In Progress
- Assignee set to Michael Kay
You need to add
visibility="public"
to the xsl:function declaration.
This is required by the W3C specification, but the rule was not enforced in Saxon 9.7. The reason for the rule is to allow the processor to inline all calls to a private function (or to perform other optimizations, e.g.exploiting that one of the arguments is always set to the value "true()") knowing that there is no need to retain the function in its original form at run-time.
Updated by Frank Steimke over 6 years ago
Yes, it works. Thank you very much.
Frank
Updated by Michael Kay over 6 years ago
- Tracker changed from Bug to Support
- Status changed from In Progress to Resolved
Updated by Michael Kay over 6 years ago
For 9.9 I have improved the diagnostics:
Error in xsl:evaluate/@xpath on line 20 column 41 of fbug.xsl:
XTDE3160: Static error in XPath expression supplied to xsl:evaluate: Cannot find a
1-argument function named {http://www.fake.org}inc(). The function exists, but does not
have public visibility.
Please register to edit this issue