#NEWLINE# def test_extensions2( self ) : #NEWLINE# #INDENT# tree = self . parse ( '<a><b>B</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    exclude-result-prefixes="myns">\n  <xsl:template match="a"><A><xsl:value-of select="myns:mytext(b)"/></A></xsl:template>\n</xsl:stylesheet>' ) #NEWLINE# def mytext( ctxt , values ) : #NEWLINE# #INDENT# return ( 'X' * len ( values ) ) #NEWLINE# #UNINDENT# namespace = etree . FunctionNamespace ( 'testns' ) #NEWLINE# namespace [ 'mytext' ] = mytext #NEWLINE# result = tree . xslt ( style ) #NEWLINE# self . assertEqual ( self . _rootstring ( result ) , _bytes ( '<A>X</A>' ) )