[ https://issues.apache.org/jira/browse/XALANJ-2809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17942109#comment-17942109 ]
Martin Honnen commented on XALANJ-2809: --------------------------------------- Did the latest patches you made to fix the issue change any dependency other than the main file xalan-java-3.0.1.jar? Anyway, here is my complete command line run output: {noformat} PS C:\Users\marti\OneDrive\Documents\xslt\blog-xslt-3-by-example\xalan-xslt3-tests> & 'C:\Program Files\Eclipse Adoptium\jdk-8.0.422.5-hotspot\bin\java.exe' -cp 'C:\Users\marti\.m2\repository\org\apache\xsl\xalan-java\3.0.1\xalan-java-3.0.1.jar;C:\Users\marti\.m2\repository\edu\princeton\cs\cup_runtime\1.0\cup_runtime-1.0.jar;C:\Users\marti\.m2\repository\edu\princeton\cs\java_cup\1.0\java_cup-1.0.jar;C:\Users\marti\.m2\repository\JLex\JLex\1.0\jlex-1.0.jar;C:\Users\marti\.m2\repository\org\apache\commons\bsf\1.0\bsf-1.0.jar;C:\Users\marti\.m2\repository\org\apache\xerces\xercesImpl\2.12.3\xercesImpl-2.12.3.jar;C:\Users\marti\.m2\repository\org\apache\xerces\xml-apis\1.4.02\xml-apis-1.4.02.jar;C:\Users\marti\.m2\repository\org\apache\xsl\xpath31_types\1.0\xpath31_types-1.0.jar;C:\Users\marti\.m2\repository\org\json\json\20240303\json-20240303.jar' '-Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.XSL3TransformerFactoryImpl' org.apache.xalan.xslt.Process -in .\sample1.xml -xsl .\fold-left-seq-of-stylesheets-transform4.xsl file:///C:/Users/marti/OneDrive/Documents/xslt/blog-xslt-3-by-example/xalan-xslt3-tests/./fold-left-seq-of-stylesheets-transform4.xsl; Zeilennummer21; Spaltennummer74; XTTE0570 : A sequence of size 2, cannot be cast to a type node(). <?xml version="1.0" encoding="UTF-8"?> {noformat} As for the complete correct output, the sample you have shown lacks the comments the sample stylesheets like sheet3.xsl add with the template of e.g. {code:xml} <xsl:template match="/"> <xsl:copy> <xsl:apply-templates/> <xsl:comment>Run with <xsl:value-of select="system-property('xsl:vendor')"/> at <xsl:value-of select="current-dateTime()"/> by sheet3.xsl</xsl:comment> </xsl:copy> </xsl:template> {code} Not sure why we get different results at this moment. Might be busy today doing some Windows/Microsoft patch day updates but hope to look at it in more detail later. Or perhaps from the above command line run you are able to spot where I might have gone wrong. > 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