Project

Profile

Help

Bug #6325

open

saxonche.PySaxonApiError: Null found in Java string conversation. Line number: -1

Added by O'Neil Delpratt 3 months ago. Updated 3 months ago.

Status:
New
Priority:
Normal
Category:
Python API
Start date:
2024-01-19
Due date:
% Done:

0%

Estimated time:
Found in version:
12.4.1
Fixed in version:
Platforms:

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

Related to SaxonC - Bug #6122: XSLT Processor unsuccessfully reads source XMLClosedO'Neil Delpratt2023-07-07

Actions
Actions #1

Updated by O'Neil Delpratt 3 months ago

  • Related to Bug #6122: XSLT Processor unsuccessfully reads source XML added
Actions #2

Updated by Martin Honnen 3 months 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.

Actions #3

Updated by O'Neil Delpratt 3 months 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

Also available in: Atom PDF