Martin Honnen created XALANJ-2739:
-------------------------------------
Summary: map:get on values returned by map:keys doesn't find a map
entry
Key: XALANJ-2739
URL: https://issues.apache.org/jira/browse/XALANJ-2739
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-CmdLine
Affects Versions: The Latest Development Code
Environment: Windows 11, Java 8
Reporter: Martin Honnen
This is a bug report on the XSLT 3.0 development branch of Xalan.
I have tried the new XDM/XPath 3.1 map feature but I see some odd failure, the
function map:keys returns a sequence of (supposedly) map key values but somehow
using map:get with those keys doesn't find any value.
XSLT code (run against any XML input file):
{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="/">
<test>
<xsl:comment>Run with <xsl:value-of
select="system-property('xsl:vendor')"/> at <xsl:value-of
select="current-dateTime()"/></xsl:comment>
<xsl:variable name="map1" select="map { 'foo' : 'bar', 'data' : [1,2,3]
}"/>
<value key="foo">
<xsl:value-of select="map:get($map1, 'foo')"/>
</value>
<map-key-values>
<xsl:for-each select="map:keys($map1)">
<value key="{.}">
<xsl:value-of select="map:get($map1, .)"/>
</value>
</xsl:for-each>
</map-key-values>
</test>
</xsl:template>
</xsl:stylesheet>
{code}
Result is e.g.
{code:java}
<?xml version="1.0" encoding="UTF-8"?><test>
<!--Run with Apache Software Foundation at 2024-05-29T12:55:37+02:00-->
<value key="foo">bar</value>
<map-key-values>
<value key="data"/>
<value key="foo"/>
</map-key-values>
</test>{code}
so somehow the returned keys from map:keys don't work as intended with map:get.
Expected result would include e.g.
{code:java}
<map-key-values>
<value key="foo">bar</value>
<value key="data">1 2 3</value>
</map-key-values>{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]