[
https://issues.apache.org/jira/browse/XALANJ-2789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mukul Gandhi resolved XALANJ-2789.
----------------------------------
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 dev repos branch xalan-j_xslt3.0.
Following are few additional notes (the mentioned OS file system paths are user
specific):
Assuming that Xalan-J's XSL 3 binary dist is unpacked into the folder
D:\xalan-j_3_0_1-bin\xalan-j_3_0_1 (which has xalan.jar and other jars produced
by the build).
Then,
1) With JRE 1.8, the following command can be used to run Xalan-J's
interpretive processor from command line,
D:\>d:\jdk-1.8\bin\java -Djava.endorsed.dirs=D:\xalan-j_3_0_1-bin\xalan-j_3_0_1
org.apache.xalan.xslt.Process -in
d:\xslt\spec-sample-of-json-represented-as-xml.xml -xsl
d:\xslt\xml-to-json-test7.xsl
2) With JRE > 1.8 the following command can be used to run Xalan-J's
interpretive processor from command line,
D:\>d:\jdk-22.0.1\bin\java -classpath
D:\xalan-j_3_0_1-bin\xalan-j_3_0_1\xalan.jar org.apache.xalan.xslt.Process -in
d:\xslt\spec-sample-of-json-represented
-as-xml.xml -xsl d:\xslt\xml-to-json-test7.xsl
> 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
> Assignee: Mukul Gandhi
> Priority: Major
> 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]