I don't know if this might help in fixing this bug, but I noticed the following things:
1. If I do the xslt transformation on a deepcopy of the subtree I do not get the memory errors when stripping whitespaces.
2. My current script uses lxml etree to find certain elements in a xml file (2,4MB) and then only uses xslt on the found sub-elements. At first this script used to run 5+ minutes. I was able to figure out that the xslt transformation was causing the problem as it seemed to go through the whole tree, even though I only passed a subtree. Here again a deepcopy solved the issue and the script works in under 1 second.
So to me it seems that when passing a subelement xslt still somehow processes the whole tree.
I don't know if this might help in fixing this bug, but I noticed the following things:
1. If I do the xslt transformation on a deepcopy of the subtree I do not get the memory errors when stripping whitespaces.
2. My current script uses lxml etree to find certain elements in a xml file (2,4MB) and then only uses xslt on the found sub-elements. At first this script used to run 5+ minutes. I was able to figure out that the xslt transformation was causing the problem as it seemed to go through the whole tree, even though I only passed a subtree. Here again a deepcopy solved the issue and the script works in under 1 second.
So to me it seems that when passing a subelement xslt still somehow processes the whole tree.
Hope that helps!