Project

Profile

Help

Bug #6336

closed

passing an array as a parameter results in an object has no attribute 'derivedaptr'

Added by Menzo Windhouwer 11 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Low
Category:
Python
Start date:
2024-01-31
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

I'm trying to pass an array to a stylesheet:

with PySaxonProcessor(license=False) as proc:
    print(proc.version)
    xsltproc = proc.new_xslt30_processor()
    xsltproc.set_cwd(os.getcwd())
    executable = xsltproc.compile_stylesheet(stylesheet_file="cat.xsl")

    value = proc.make_array([proc.make_integer_value(i) for i in [8,9,10]])
    print(value)
    executable.set_parameter("values", value)

    result = executable.apply_templates_returning_string(source_file="person.xml")
    print(result)

However, this results in:

    SaxonC-HE 12.4.2 from Saxonica
    [8,9,10]
    Traceback (most recent call last):
        File "/Users/menzowi/Temp/saxontest/saxon.py", line 22, in <module>
        executable.set_parameter("values", value)
     File "python_saxon/saxonc.pyx", line 1958, in saxonche.PyXsltExecutable.set_parameter
     AttributeError: 'saxonche.PyXdmArray' object has no attribute 'derivedaptr'

I expected a result an XML document with each of the values in the array multiplied by 3. Using this sytlesheet:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0">
    <xsl:param name="values" select="(2, 3, 4, 5)"/>
    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="*">
        <output>
            <xsl:for-each select="$values">
                <out>
                    <xsl:value-of select=". * 3"/>
                </out>
            </xsl:for-each>
        </output>
    </xsl:template>
</xsl:stylesheet>

Files

Archive.zip (2.62 KB) Archive.zip code that shows the bug Menzo Windhouwer, 2024-01-31 17:02

Related issues

Has duplicate SaxonC - Bug #6335: AttributeError: 'saxonche.PyXdmArray' object has no attribute 'derivedaptr'ClosedO'Neil Delpratt2024-01-30

Actions

Please register to edit this issue

Also available in: Atom PDF