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

Mukul Gandhi commented on XALANJ-2738:
--------------------------------------

[~martin.honnen], hoping to look at this issue at earliest. just been busy with 
few other tasks.

> getting error "The 1st argument of array:get function call, needs to be an 
> xdm array" on map:get of XDM map returned by parse-json which should be XDM 
> array
> ------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: XALANJ-2738
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2738
>             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-interpretive
>    Affects Versions: The Latest Development Code
>         Environment: Windows 11, Java 8
>            Reporter: Martin Honnen
>            Assignee: Mukul Gandhi
>            Priority: Major
>         Attachments: parse-json-test1.xsl, xml-sample-with-json-data1.xml
>
>
> This is a bug report on the XSLT 3.0 development branch of Xalan.
>  
> I have tried to use an XPath 3.1 array function like array:get on the result 
> of calling map:get on the result of parse-json and while that works fine in 
> an XSLT 3 processor like Saxon HE 12 for Xalan it fails with "The 1st 
> argument of array:get function call, needs to be an xdm array".
>  
> Here is the code, XML sample:
> {code:java}
> <root>
>   <data>{ "foo" : "bar", "data" : [1,2,3] }</data>
> </root>{code}
>  
> XSLT:
>  
> {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";
>   xmlns:map="http://www.w3.org/2005/xpath-functions/map";
>   xmlns:array="http://www.w3.org/2005/xpath-functions/array";
>   exclude-result-prefixes="xs map array">
>   <xsl:output method="html" indent="no"/>
>   <xsl:template match="@* | node()" name="identity">
>     <xsl:copy>
>       <xsl:apply-templates select="@* | node()"/>
>     </xsl:copy>
>   </xsl:template>
>   
>   <xsl:template match="data">
>     <xsl:call-template name="identity"/>
>     <xsl:variable name="json-map" select="parse-json(.)"/>
>     <xsl:comment>
>       <xsl:value-of select="array:get(map:get($json-map, 'data'), 1)"/>
>     </xsl:comment>
>   </xsl:template>
>   <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()"/></xsl:comment>
>     </xsl:copy>
>   </xsl:template>
> </xsl:stylesheet>
> {code}
>  
>  
> Results in error
> {noformat}
> file:///C:/Users/marti/IdeaProjects/xalan-java/../../OneDrive/Documents/xslt/blog-xslt-3-by-example/xalan-xslt3-tests/parse-json-test1.xsl;
>  Zeilennummer21; Spaltennummer72; javax.xml.transform.TransformerException: 
> FORG0006 : The 1st argument of array:get function call, needs to be an xdm 
> array{noformat}
>  
> The expected result is the value 1 in the comment as the expression 
> `array:get(map:get($json-map, 'data'), 1)` should just select the XDM array 
> and read out its first array item, the number value 1.



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