[
https://issues.apache.org/jira/browse/XALANJ-2789?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17894992#comment-17894992
]
Mukul Gandhi commented on XALANJ-2789:
--------------------------------------
[~martin.honnen]
>From Xalan-J's latest XSL 3 codebase on repos, after making a build with ant
>"dist" target I get the distributable archive xalan-j_3_0_1-bin.zip. After
>unpacking this distribution archive, when I run Xalan-J's interpretive
>processor from command-line using XML and XSL stylesheet documents that you've
>provided, I get following error,
test1.xsl; Line #8; Column #46; javax.xml.transform.TransformerException:
FOAP0001 : An XML Schema validation of function fn:xml-to-json's 1st argument
which is an XML node, failed with following XML Schema validation result
details : schema_reference.4: Failed to read schema document
'file:/D:/xalan-j_3_0_1-bin/xalan-j_3_0_1/schema-for-json.xsd', because 1)
could not find the document; 2) the document could not be read; 3) the root
element of the document is not <xsd:schema>.
I'm able to see that, an XML Schema document schema-for-json.xsd is not
produced within the build jar file xalan.jar. I think, an XML Schema document
schema-for-json.xsd needs to be provided within xalan.jar, which shall require
modifications to Xalan-J's ant build script. The file schema-for-json.xsd is
available within Xalan-J's src codebase at location
src/org/apache/xpath/functions/json.
Although, running an XSL transform example provided by you in this jira issue,
from within dev ide works fine for me.
A github PR is always welcome, for resolution of bug reports.
> 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
> 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]