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 3 months ago. Updated 3 months ago.

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

100%

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

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