<elements xmlns:py="http://genshi.edgewall.org/">
<py:for each="el in elements">
${el}
</py:for>
</elements>
</my_output>
"""
tpl = MarkupTemplate(templatestr)
str = tpl.generate(elements=list_with_xml_markup_strings)
for x in str.serialize():
print x
The elements passed to the template are of the form:
el = '<element p:attribute="something"><child/>...</element>'
However, in the output, even if the list from which to generate elements is empty, genshi seems to remove the xmlns:p declaration from my root element, and add p: attributes to all the elements in the template (but not the ones passed by generate() ).
Basically, it looks like this:
<p:my_output xmlns="http://some-address.com/sub/nr" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=http://some-address.com/sub/nr http://some-address.com/sub/nr/src/xml/file.xsd" p:majorVersion="0" p:minorVersion="00" p:version="version 0.00">
<p:elements xmlns:py="http://genshi.edgewall.org/">
etcetera.
Is this expected behaviour? And if yes, what should I do to have the attributes remain in place?
cheers,
jorrit