lxml and xslt extensions

dasacc22 dasacc22 at gmail.com
Sat Apr 4 11:31:03 EDT 2009


Hi,

Im not sure where else to ask this. But basically Im having trouble
figuring out how to successfully apply multiple extensions in a single
transformation. So for example if i have
<xsl:stylesheet .../>
<xsl:template...>
<my:tag/>
<my:tag/>
</xsl:template>
</xsl:stylesheet>

in my xsl and my xslt extension looks like

class TagExtension(etree.XSLTExtension):
  def execute( ..., output_parent):
    print 'executing tag_extension'
    tag = etree.Element('p')
    tag.text = 'Hello'
    output_parent.append(tag)

well then the transformation works for the first tag and appends it to
the root of the created doc but all subsequent calls dont append
(maybe b/c output_parent is now somewhere else for return?). And to
clarify, I know that its the first call that completes and all
subsequent calls fail b/c i have a subsequent call that performs a
different transformation.

Thanks for any help or hints,
Daniel



More information about the Python-list mailing list