#NEWLINE# def test_extension_element_process_children( self ) : #NEWLINE# #INDENT# tree = self . parse ( '<a><b>E</b></a>' ) #NEWLINE# style = self . parse ( '<xsl:stylesheet version="1.0"\n    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\n    xmlns:myns="testns"\n    extension-element-prefixes="myns">\n  <xsl:template match="a">\n    <xsl:variable name="testvar">yo</xsl:variable>\n    <A>\n      <myns:myext>\n        <xsl:attribute name="attr">\n          <xsl:value-of select="$testvar" />\n        </xsl:attribute>\n        <B>\n          <xsl:choose>\n            <xsl:when test="1 = 2"><C/></xsl:when>\n            <xsl:otherwise><D><xsl:value-of select="b/text()" /></D></xsl:otherwise>\n          </xsl:choose>\n        </B>\n      </myns:myext>\n    </A>\n  </xsl:template>\n</xsl:stylesheet>' ) #NEWLINE# class MyExt ( etree . XSLTExtension ) : #NEWLINE# #INDENT# def execute( self , context , self_node , input_node , output_parent ) : #NEWLINE# #INDENT# el = etree . Element ( 'MY' ) #NEWLINE# self . process_children ( context , el ) #NEWLINE# output_parent . append ( el ) #NEWLINE# #UNINDENT# #UNINDENT# extensions = { #NEWLINE# #INDENT# ( 'testns' , 'myext' ) : MyExt ( ) , #NEWLINE# #UNINDENT# } #NEWLINE# result = tree . xslt ( style , extensions = extensions ) #NEWLINE# self . assertEqual ( self . _rootstring ( result ) , _bytes ( '<A><MYattr="yo"><B><D>E</D></B></MY></A>' ) )