[
https://issues.apache.org/jira/browse/XALANJ-2751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17856746#comment-17856746
]
Mukul Gandhi edited comment on XALANJ-2751 at 6/21/24 12:10 PM:
----------------------------------------------------------------
I'm resolving this issue as fixed. The fix for this issue, has been committed
to Xalan-J dev repos branch xalan-j_xslt3.0.
This fix produces following, XSL transformation result with sample XML and XSL
stylesheet examples provided:
<?xml version="1.0" encoding="UTF-8"?>
<tags>
<value>3</value>
<value>2</value>
<value>1</value>
</tags>
Xalan-J XSL 3 implementation on 3.0 dev repos branch, considers processing XDM
sequence and array in a similar way with XSL instruction xsl:for-each
select="..." (i.e, an array [1,2,3], or a sequence (1,2,3) will cause an XSL
instruction xsl:for-each select="$seqOrArray", to process xsl:for-each's
contained sequence constructor thrice).
was (Author: mukul_gandhi):
I'm resolving this issue as fixed. The fix for this issue, has been committed
to Xalan-J dev repos branch xalan-j_xslt3.0.
This fix produces following, XSL transformation result with sample XML and XSL
stylesheet examples provided:
<?xml version="1.0" encoding="UTF-8"?>
<tags>
<value>3</value>
<value>2</value>
<value>1</value>
</tags>
Xalan-J XSL 3 implementation, considers processing sequence and array in a
similar way with xsl:for-each select="..." expression (i.e, an array [1,2,3]
and a sequence (1,2,3) will cause XSL instruction xsl:for-each
select="$seqOrArray" to do three iterations).
> NullPointerException when using XDM 3.1 function map:get on XDM map created
> with parse-json
> -------------------------------------------------------------------------------------------
>
> Key: XALANJ-2751
> URL: https://issues.apache.org/jira/browse/XALANJ-2751
> 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
> Environment: Java 8, Windows 11
> Reporter: Martin Honnen
> Assignee: Mukul Gandhi
> Priority: Major
> Attachments: parse-json-map-get-test1.xsl,
> xml-sample-with-json-data3.xml
>
>
> This is a bug report on the Xalan Java XSLT 3 development branch.
> While exploring the support for dealing with JSON data in the forms of XDM
> 3.1 maps and arrays I found a simple test case causing a
> java.lang.NullPointerException.
> Sample 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="xml" indent="yes"/>
> <xsl:template match="json">
> <tags>
> <xsl:variable name="xdm-map" select="parse-json(.)"/>
> <xsl:for-each select="map:get($xdm-map, 'data')">
> <value>
> <xsl:value-of select="."/>
> </value>
> </xsl:for-each>
> </tags>
> <xsl:comment>Run with <xsl:value-of
> select="system-property('xsl:vendor')"/> at <xsl:value-of
> select="current-dateTime()"/></xsl:comment>
> </xsl:template>
> </xsl:stylesheet>
> {code}
>
>
> Sample XML:
> {code:java}
> <root>
> <json>{ "name" : "foo", "data" : [3,2,1] }</json>
> </root>{code}
> Output:
> {noformat}
> <?xml version="1.0" encoding="UTF-8"?>
>
> file:///C:/Users/marti/IdeaProjects/xalan-java/../../OneDrive/Documents/xslt/blog-xslt-3-by-example/xalan-xslt3-tests/parse-json-map-get-test1.xsl;
> Zeilennummer14; Spaltennummer56; java.lang.NullPointerException{noformat}
> Expected output is e.g.
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
> <tags>
> <value>3 2 1</value>
> </tags>
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]