#NEWLINE# def test_extension_element_process_children_with_subextension_element( self ) : #NEWLINE# #INDENT# tree = self . parse ( '<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    <myns:myext>\n      <A><myns:myext><B/></myns:myext></A>\n    </myns:myext>\n  </xsl:template>\n</xsl:stylesheet>' ) #NEWLINE# class MyExt ( etree . XSLTExtension ) : #NEWLINE# #INDENT# callback_call_counter = 0 #NEWLINE# def execute( self , context , self_node , input_node , output_parent ) : #NEWLINE# #INDENT# self . callback_call_counter += 1 #NEWLINE# el = etree . Element ( 'MY' , n = str ( self . callback_call_counter ) ) #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 ( '<MYn="1"><A><MYn="2"><B/></MY></A></MY>' ) )