[ 
https://issues.apache.org/jira/browse/XALANJ-2809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17942081#comment-17942081
 ] 

Mukul Gandhi commented on XALANJ-2809:
--------------------------------------

[~martin.honnen]
IMHO, I don't get any error as you're claiming with the latest Xalan-J code 
base on it's XSL 3 dev respos branch.

With the files that you've attached with this jira issue, when I'm doing 
Xalan-J's XSL 3 transform with XML input document as sample1.xml and the 
stylesheet file as fold-left-seq-of-stylesheets-transform4.xsl, I'm getting 
following XSL transform result,

<?xml version="1.0" encoding="UTF-8"?><root>
  <data>[3, 2, 1]</data>
</root>

Which I think is the correct XSL transformation's expected result, for the jira 
issue files for this bug report that you've attached.

If you're really getting an XSL transformation run-time error, as you've 
written within your previous message for this jira issue, requesting you to 
please clarify better for us to replicate the issue that you've mentioned, and 
possibly attempt a fix.

> XPTY0004 when using fold-left and XSLT defined function, followed by 
> java.lang.NullPointerException
> ---------------------------------------------------------------------------------------------------
>
>                 Key: XALANJ-2809
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2809
>             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, Xalan-CmdLine, 
> Xalan-interpretive, XPath-function
>    Affects Versions: The Latest Development Code
>         Environment: Java 8, Windows 11
>            Reporter: Martin Honnen
>            Assignee: Mukul Gandhi
>            Priority: Major
>         Attachments: fold-left-seq-of-stylesheets-transform4.xsl, 
> pass-document-node-to-xslt-function-test1.xsl, sample1.xml, sheet1.xsl, 
> sheet2.xsl, sheet3.xsl
>
>
> This is a bug report against the XSLT 3.0 development branch of Xalan.
> I am still trying to use the function fold-left with some XSLT defined 
> function but run into a strange error "XPTY0004 Function call argument at 
> position 1 for function
> {http://example.com/mf}
> identity(), doesn't match the declared parameter type node()" followed by a 
> java.lang.NullPointerException.
> {code:xml}
> <?xml version="1.0" encoding="utf-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>   version="3.0"
>   xmlns:xs="http://www.w3.org/2001/XMLSchema";
>   xmlns:mf="http://example.com/mf";
>   exclude-result-prefixes="xs mf">
>   <xsl:output method="xml" indent="yes"/>
>   <xsl:function name="mf:identity" as="node()">
>     <xsl:param name="node" as="node()"/>
>     <xsl:sequence select="$node"/>
>   </xsl:function>
>   <xsl:template match="/">
>     <xsl:copy>
>       <xsl:sequence select="fold-left(//*, (), function($a, $n) { ($a, 
> mf:identity($n)) })"/>
>     </xsl:copy>
>   </xsl:template>
> </xsl:stylesheet>
> {code}
> Run that against any XML input and you will get the XPTY0004 for each element 
> node in the input followed by the NullPointerException.
>  
> The code runs with with Saxon HE 12.5 Java as well as SaxonJS so I think it 
> is clean and proper XSLT 3.
>  
> The shown code is a reduced test case whether I can get any node passed from 
> fold-left to an XSLT defined function, my real use case is using fold-left to 
> chain calls of the transform function, as I get the same error "XPTY0004 : 
> Function call argument at position 1 for function 
> \{http://example.com/mf}transform-node(), doesn't match the declared 
> parameter type node()" there I hope if the simple test case can be fixed the 
> real use case also works.
> For completeness I tried to attach the real use as well but somehow attaching 
> currently fails. I will try to attach the file later after I have created the 
> bug issue.
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org
For additional commands, e-mail: dev-h...@xalan.apache.org

Reply via email to