Project

Profile

Help

Bug #6357

closed

Exception: Source object is not of type (String, XdmValue or XdmValue[]). Line number: -1

Added by O'Neil Delpratt 10 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
SaxonC API
Start date:
2024-02-21
Due date:
% Done:

100%

Estimated time:
Applies to branch:
Fix Committed on Branch:
12
Fixed in Maintenance Release:
Found in version:
12.4.2
Fixed in version:
12.5
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

Description

The following PHP script fails with the exception below:

        $transformer = self::$saxonProc->newXslt30Processor();
        $source = "<?xml version='1.0'?>" .
            "                <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'" .
            "                xmlns:xs='http://www.w3.org/2001/XMLSchema'" .
            "                version='3.0'>" .
            "                <xsl:output method='text' item-separator='~~'/>" .
            "                <xsl:template match='.'>" .
            "                   <xsl:param name='a' as='xs:double'/>" .
            "                   <xsl:param name='b' as='xs:float'/>" .
            "                   <xsl:sequence select='., \$a + \$b'/>" .
            "                </xsl:template>" .
            "                </xsl:stylesheet>";
        $executable = $transformer->compileFromString($source);
        $executable->setProperty("!omit-xml-declaration", "yes");
        $executable->setResultAsRawValue(True);
        $executable->setInitialTemplateParameters(array("a" => self::$saxonProc->createAtomicValue(12), "b" => self::$saxonProc->createAtomicValue(5)));
        $executable->setInitialMatchSelection(self::$saxonProc->createAtomicValue(16));
        $sw = $executable->applyTemplatesReturningString();

Exception:

Exception: Source object is not of type (String, XdmValue or XdmValue[]). Line number: -1

It looks like the setInitialMatchSelection method is not correctly passing the XdmAtomicValue. After more investigation the selection is being passed as null in the Java code.

Please register to edit this issue

Also available in: Atom PDF