[ 
https://issues.apache.org/jira/browse/XALANJ-2800?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mukul Gandhi resolved XALANJ-2800.
----------------------------------
      Assignee: Mukul Gandhi
    Resolution: Fixed

I'm resolving this jira issue as fixed. The fix for this jira issue, has been 
committed to Xalan-J's XSL 3 dev repos branch.

> NullPointerException when using XSLT key function call on right side of XPath 
> 3.1 map ! operator
> ------------------------------------------------------------------------------------------------
>
>                 Key: XALANJ-2800
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2800
>             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-CmdLine
>    Affects Versions: The Latest Development Code
>         Environment: Java 8, Windows 11
>            Reporter: Martin Honnen
>            Assignee: Mukul Gandhi
>            Priority: Major
>         Attachments: cars.xml, key-fn-call-in-map-exp-test2.xsl
>
>
> Using the latest Xalan XSLT 3.0 development branch, I get a 
> NullPointerException when trying to use an XSLT key function call on the 
> right side of the XPath 3.1 map operator "!".
>  
> Expected result: the code should not give any errors but output e.g.
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <set>
>    <problem>
>       <question>Which lots have red cars?</question>
>       <answer>
>          <lot id="L"/>
>          <lot id="L"/>
>          <lot id="N"/>
>       </answer>
>    </problem>
> </set>
> {code}
> The XSLT code:
> {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";
>   exclude-result-prefixes="xs">
>   <xsl:output method="xml" indent="yes"/>
>   <xsl:key name="car-by-color" match="cars/car" use="@color"/>
>      
>   <xsl:key name="lot-for-car" match="lot" use="car/@vin"/>
>    
>   <xsl:template match="lot">
>       <lot id="{@id}"/>
>   </xsl:template>
>   
>   <xsl:template match="/">
>       <set>
>           <problem>
>               <question>Which lots have red cars?</question>
>               <answer>
>                   <xsl:apply-templates select="(key('car-by-color', 'red') ! 
> key('lot-for-car', @vin))"/>
>               </answer>
>           </problem>
>       </set>
>   </xsl:template>
> </xsl:stylesheet>
> {code}
> XML input:
> {code:xml}
> <dir>
>     <cars>
>         <car vin="101" color="red"/>
>         <car vin="102" color="green"/>
>         <car vin="103" color="red"/>
>         <car vin="104" color="red"/>
>     </cars>
>     <lots>
>         <lot id="L">
>             <car vin="101"/>
>             <car vin="103"/>
>         </lot>
>         <lot id="M">
>             <car vin="102"/>
>         </lot>
>         <lot id="N">
>             <car vin="104"/>
>         </lot>
>     </lots>
> </dir>
> {code}
> Full error output:
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?><set>
>   <problem>
>     <question>Which lots have red 
> cars?</question>file:///C:/Users/marti/IdeaProjects/xalan-java/../../OneDrive/Documents/xslt/blog-xslt-3-by-example/xalan-xslt3-tests/key-fn-call-in-map-exp-test2.xsl;
>  Zeilennummer22; Spaltennummer106; java.lang.NullPointerException
> {code}



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