[
https://issues.apache.org/jira/browse/XALANJ-2808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17941223#comment-17941223
]
Martin Honnen commented on XALANJ-2808:
---------------------------------------
I am afraid you are completely wrong, where in that specification do you read
that?
And https://www.w3.org/TR/xslt20/#stylesheet-functions says: "An xsl:function
declaration declares the name, parameters, and implementation of a stylesheet
function that can be called from any XPath expression within the stylesheet.".
And https://www.w3.org/TR/xslt-30/#stylesheet-functions: "An xsl:function
declaration declares the name, parameters, and implementation of a stylesheet
function that can be called from any XPath expression within the stylesheet".
The only restriction there is is https://www.w3.org/TR/xslt-30/#hof-feature
that says: "The higher-order functions feature contains functionality connected
with the use of functions as items in the data model, that can be stored in
variables and passed to other functions" and later
{quote}Where a processor does not provide the higher-order functions feature,
functions whose specification in [Functions and Operators 3.1] labels them with
the higher-order property are excluded from the static context of expressions
and patterns. An attempt to reference such a function therefore fails in the
same way as an attempt to call a non-existent function.
Note:
Examples of functions labeled with this property are filterFO30, for-eachFO30,
fold-leftFO30, and fold-rightFO30{quote}
But if you make higher-order functions like fold-left available then they take
any fitting function, it shouldn't matter whether it is defined inline in XPath
or with xsl:function in XSLT, see for instance
https://github.com/w3c/xslt30-test/blob/master/tests/expr/higher-order-functions/higher-order-functions-076.xsl.
> can't pass XSLT defined xsl:function to fold-left: FORG0006 : The third
> argument to function call fn:fold-left is not a function item, or cannot be
> coerced to a function item
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: XALANJ-2808
> URL: https://issues.apache.org/jira/browse/XALANJ-2808
> Project: XalanJ2
> Issue Type: Bug
> Security Level: No security risk; visible to anyone(Ordinary problems in
> Xalan projects. Anybody can view the issue.)
> Components: transformation, Xalan, XPath-function
> Affects Versions: The Latest Development Code
> Environment: Java 8, Windows 11
> Reporter: Martin Honnen
> Assignee: Mukul Gandhi
> Priority: Major
> Attachments: fold-left-pass-user-defined-xslt-function-test1.xsl,
> fold-left-seq-of-stylesheets-transform4.xsl
>
>
> This is a bug report against the XSLT 3 development branch of Xalan.
> I am trying to pass a function defined in XSLT with xsl:function to the
> higher-order function fold-left but Xalan doesn't seem to support that so
> far, I get " FORG0006 : The third argument to function call fn:fold-left is
> not a function item, or cannot be coerced to a function item".
> An XSLT stylesheet is attached, it can be run against the file
> src/test/resources/fn_fold_left/test1_a.xml in the Xalan branch.
> In my view the function call should work and the result should be e.g.
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <result>
> <val1>210</val1>
> <val2>210</val2>
> </result>
> {code}
> I get the same problem with more complex code trying to use the transform
> function, the stylesheet is also attached.
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]