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

Mukul Gandhi edited comment on XALANJ-2746 at 6/7/24 5:33 AM:
--------------------------------------------------------------

[~martin.honnen], you're right. This is a defect.
.
In-fact, Xalan-J's xsl3 implementation currently has limitation, where literal 
sequence constructor expressions can be successfully parsed and shall function 
correctly, only when they form an entire XPath expression. i.e, an XPath 
expression (1,2,3) shall work fine with Xalan-J currently.

But Xalan-J currently cannot handle,
for e.g, ... (1,2,3) OR (1,2,3) ...
(i.e, when an xpath sequence constructor is preceded or followed by any valid 
tokens)

As a little workaround, your example shall work fine if we make use of XSL 
variables, for e.g as follows,

<xsl:variable name="seq1" select="(1,2,3)"/>
<xsl:value-of select="$seq1 => sum()"/>

For kind information, for few other Xalan-J xpath expressions as well, for e.g 
literal non-empty sequence constructors shall not work fine as function 
arguments (but we can use xsl:variable as workaround, for them).


was (Author: mukul_gandhi):
[~martin.honnen], you're right. This is a defect.
.
In-fact, Xalan-J's xsl3 implementation currently has limitation, where literal 
sequence constructor expressions can be successfully parsed and shall function 
correctly, only when they form an entire XPath expression. i.e, (1,2,3) shall 
work fine with Xalan-J currently.

But Xalan-J currently cannot handle,
for e.g, ... (1,2,3) OR (1,2,3) ...
(i.e, when an xpath sequence constructor is preceded or followed by any valid 
tokens)

As a little workaround, your example shall work fine if we make use of XSL 
variables, for e.g as follows,

<xsl:variable name="seq1" select="(1,2,3)"/>
<xsl:value-of select="$seq1 => sum()"/>

For kind information, for few other Xalan-J xpath expressions as well, for e.g 
literal non-empty sequence constructors shall not work fine as function 
arguments (but we can use xsl:variable as workaround, for them).

> NullPointerException on use of arrow operator (1 to 5) => sum()
> ---------------------------------------------------------------
>
>                 Key: XALANJ-2746
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2746
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in 
> Xalan projects.  Anybody can view the issue.) 
>          Components: Xalan, Xalan-CmdLine
>            Reporter: Martin Honnen
>            Priority: Major
>         Attachments: arrow-operator-test1.xsl
>
>
> This is a bug report on the XSLT 3 development branch of Xalan.
> I see that the arrow operator => has been implemented but I have written a 
> simple test case that gives a NullPointerException:
> Sample XSLT (run against any XML input):
>  
> {code:java}
> <?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";
>   exclude-result-prefixes="xs">
>   <xsl:template match="/">
>     <xsl:copy>
>       <test-arrow-operator>
>         <xsl:value-of select="(1 to 5) => sum()"/>
>       </test-arrow-operator>
>       <xsl:comment>Run with <xsl:value-of 
> select="system-property('xsl:vendor')"/> at <xsl:value-of 
> select="current-dateTime()"/></xsl:comment>
>     </xsl:copy>
>   </xsl:template>
> </xsl:stylesheet>
> {code}
>  
> gives an error java.lang.NullPointerException
> {noformat}
> file:///C:/Users/marti/IdeaProjects/xalan-java/../../OneDrive/Documents/xslt/blog-xslt-3-by-example/xalan-xslt3-tests/arrow-operator-test1.xsl;
>  Zeilennummer10; Spaltennummer51; java.lang.NullPointerException{noformat}
> Expected result would be `<test-arrow-operator>15</test-arrow-operator>`.



--
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