Hi all. I'm having some problems perhaps related to usage, perhaps not. Below is a script: =================================== import os, lxml.etree delivdir = os.path.split(os.path.abspath(__file__))[0][:-3] class Test: def __init__ (self): # Load the compiler-blank and compiler docs compilerblankdoc = loadfile("lib/blank-compiled.xml") compilerdoc = loadfile("lib/compiler.xsl") # Compile the compiler-blank into our style doc for repeated use compilerstyle = lxml.etree.XSLT(compilerdoc) self.compiledstyle = compilerstyle.apply(compilerblankdoc) self.processor = lxml.etree.XSLT(self.compiledstyle) def transformToString(self, inputdoc): """Run the compiled stylesheet against the input doc""" result = self.processor.apply(inputdoc) return self.processor.tostring(result).encode("utf-8") def loadfile (fn): """Load a file and return an xml dom""" f = open(delivdir + fn, "r") doc = lxml.etree.parse(f) f.close() del f return doc def main (): """Used for command-line debugging""" d = Test() sampledoc = loadfile("tests/sampledoc1.xml") result = d.transformToString(sampledoc) print result return d if __name__ == "__main__": main() =================================== When I run it, the string that is produced (in the main() function) seems very truncated relative to inspection by walking the nodes manually. Also, I get a bunch of: python(8231) malloc: *** Deallocation of a pointer not malloced: 0x1845235; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug python(8231) malloc: *** Deallocation of a pointer not malloced: 0x1845117; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug etc. When I run the same stylesheet and transform via xsltproc from the command line, all works ok. --Paul