Bug #6325
opensaxonche.PySaxonApiError: Null found in Java string conversation. Line number: -1
0%
Description
Reported by user via email.
The user is migrating from saxonpy to saxonche.
Error reported:
saxonche.PySaxonApiError: Null found in Java string conversation. Line number: -1
You can find the Git repository with the relevant files and code here:
https://github.com/sirisha09-till/xml2dita/tree/main/xml2dita
Related issues
Updated by O'Neil Delpratt about 1 year ago
- Related to Bug #6122: XSLT Processor unsuccessfully reads source XML added
Updated by Martin Honnen about 1 year ago
My (pure) suspicion is that the use of document-uri
, while processing a collection, fails, see https://www.saxonica.com/html/documentation12/functions/fn/document-uri.html for some explanation.
So instead of
<xsl:for-each select="collection(concat($xmldirpath, '?select=*.xml;recurse=yes'))">
<xsl:variable name="file" select="fn:ditafilepath(document-uri(.))"/>
I would try
<xsl:for-each select="collection(concat($xmldirpath, '?select=*.xml;recurse=yes'))">
<xsl:variable name="file" select="fn:ditafilepath(base-uri(.))"/>
or instead of collection
I would use uri-collection
and then use <xsl:variable name="file" select="fn:ditafilepath(.)"/>
and process doc(.)
e.g. with wrapping <xsl:for-each select="doc(.)"><xsl:result-document href="{$filePath}" method="xml" encoding="UTF-8" indent="no">..</xsl:result-document></xsl:for-each>
or push doc(.)
through a template with <xsl:apply-templates select="doc(.)"/>
where you have <xsl:template match="/"><xsl:result-document href="{$filePath}" method="xml" encoding="UTF-8" indent="no">...</xsl:result-document></xsl:template>
.
But I haven't run any code, the error might still result from some very different use of XSLT or the Python API. Only I think the XSLT as shown doesn't work in Saxon 12 with the known change for document-uri
no longer working for documents in collections, whether it is SaxonC and the Python API or Saxon Java.
Updated by O'Neil Delpratt about 1 year ago
Hi Martin, you are indeed correct the use of base-uri()
was the solution I recommended to the user earlier. Their problem is now resolved, but I still think we could do better with the reported error message "Null found in Java string conversation
".
Please register to edit this issue