Martin Honnen created XALANJ-2789:
-------------------------------------
Summary: FOAP0001 : There was an issue, processing an xdm input
node provided as an argument to function call fn:xml-to-json trying to use
XPath 3.1 function xml-to-json
Key: XALANJ-2789
URL: https://issues.apache.org/jira/browse/XALANJ-2789
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, Xalan-CmdLine
Affects Versions: The Latest Development Code
Environment: Java 8, Windows 11
Reporter: Martin Honnen
Attachments: spec-sample-of-json-represented-as-xml.xml,
xml-to-json-test7.xsl
With the latest Xalan XSLT 3.0 development build of today I fail to use the
`xml-to-json` function, I run into an error
{noformat}
file:///C:/Users/marti/IdeaProjects/xalan-java/../../OneDrive/Documents/xslt/blog-xslt-3-by-example/xml-to-json/xml-to-json-test7.xsl;
Zeilennummer10; Spaltennummer46; javax.xml.transform.TransformerException:
FOAP0001 : There was an issue, processing an xdm input node provided as an
argument to function call fn:xml-to-json.{noformat}
Sample XML input:
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<map xmlns="http://www.w3.org/2005/xpath-functions">
<string key='desc'>Distances between several cities, in kilometers.</string>
<string key='updated'>2014-02-04T18:50:45</string>
<boolean key="uptodate">true</boolean>
<null key="author"/>
<map key='cities'>
<array key="Brussels">
<map>
<string key="to">London</string>
<number key="distance">322</number>
</map>
<map>
<string key="to">Paris</string>
<number key="distance">265</number>
</map>
<map>
<string key="to">Amsterdam</string>
<number key="distance">173</number>
</map>
</array>
<array key="London">
<map>
<string key="to">Brussels</string>
<number key="distance">322</number>
</map>
<map>
<string key="to">Paris</string>
<number key="distance">344</number>
</map>
<map>
<string key="to">Amsterdam</string>
<number key="distance">358</number>
</map>
</array>
<array key="Paris">
<map>
<string key="to">Brussels</string>
<number key="distance">265</number>
</map>
<map>
<string key="to">London</string>
<number key="distance">344</number>
</map>
<map>
<string key="to">Amsterdam</string>
<number key="distance">431</number>
</map>
</array>
<array key="Amsterdam">
<map>
<string key="to">Brussels</string>
<number key="distance">173</number>
</map>
<map>
<string key="to">London</string>
<number key="distance">358</number>
</map>
<map>
<string key="to">Paris</string>
<number key="distance">431</number>
</map>
</array>
</map>
</map>{code}
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"
exclude-result-prefixes="xs">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:value-of select="xml-to-json(.)"/>
</xsl:template>
</xsl:stylesheet>
{code}
Saxon HE 12.5 runs the XSLT 3 code fine.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]