Actions
Bug #6336
closedpassing an array as a parameter results in an object has no attribute 'derivedaptr'
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
Related issues
Updated by O'Neil Delpratt 10 months ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Thanks for reporting this issue and supplying a repo.
Bug fixed and committed to the repos.
As mention in the stack overflow post the passing of an XdmArray to the stylesheet which expects an XdmValue will give the following error:
XPTY0004: A sequence of more than one item is not allowed as the first operand of '*' ([8, 9, 10])
Updated by O'Neil Delpratt 10 months ago
- Has duplicate Bug #6335: AttributeError: 'saxonche.PyXdmArray' object has no attribute 'derivedaptr' added
Updated by O'Neil Delpratt 5 months ago
- Status changed from Resolved to Closed
- Fixed in version set to 12.5
Bug fix applied in the Saxon 12.5 Maintenance release.
Please register to edit this issue
Actions