[4suite] TextWriter bug ?
Alexandre Fayolle
alf at logilab.com
Fri Sep 22 03:57:42 MDT 2000
On Thu, 21 Sep 2000, Mike Olson wrote:
> Alexandre Fayolle wrote:
> >
> > Hello...
>
> hmm... Itried to reproduce this and I couldn't.....
OK, if I use xml.xslt._4xslt, it works fine.
However, by investigating a bit further, I've found something
interesting. We where using XSLT in a slightly different way. _4xslt does
something like this (this is much simplified code, no command line option
processing, single stylesheet used:
-----------------8<---------------
from xml.xpath import Evaluate
from xml.xslt.Processor import Processor
def test():
import sys
#xml_dom = Sax2.FromXmlFile(sys.argv[1])
processor=Processor()
#transformation=Sax2.FromXmlFile(sys.argv[2])
processor.appendStylesheetFile(sys.argv[2])
result = processor.runUri(sys.argv[1],ignorePis=1)
print(result)
if __name__ == '__main__':
test()
-----------------8<---------------
and it works fine.
If we modify it slightly, and use appendStyleSheetNode however, things get
curious:
-----------------8<---------------
from xml.dom.ext.reader import Sax2
from xml.xpath import Evaluate
from xml.xslt.Processor import Processor
def test():
import sys
#xml_dom = Sax2.FromXmlFile(sys.argv[1])
processor=Processor()
transformation=Sax2.FromXmlFile(sys.argv[2])
processor.appendStylesheetNode(transformation)
result = processor.runUri(sys.argv[1],ignorePis=1)
print result
Print(result)
if __name__ == '__main__':
test()
-----------------8<---------------
In this case, we get the error mentionned in my original bug. Curiouser
and curiouser, if we use DowWriter in runUri, there is no error, but the
output is very strange ( and spaces everywhere).
Now the solution is to use StripXml on the transformation, and afterwards
everything works properly. Maybe the StripXml should be in
appendStylesheetNode?
Cheers,
--
Alexandre Fayolle
http://www.logilab.com - "Mais o est donc Ornicar ?" -
LOGILAB, Paris (France).
More information about the 4suite
mailing list