1.1 --- a/XSLOutput.py Sun May 08 23:13:39 2005 +0000
1.2 +++ b/XSLOutput.py Sun May 15 19:54:13 2005 +0000
1.3 @@ -6,7 +6,7 @@
1.4
1.5 # NOTE: Make this use other implementations, too.
1.6
1.7 -import libxslt
1.8 +import libxsltmod
1.9 import libxml2dom
1.10
1.11 class OutputError(Exception):
1.12 @@ -33,7 +33,7 @@
1.13
1.14 self.stylesheets = []
1.15 for filename in filenames:
1.16 - self.stylesheets.append(libxslt.parseStylesheetFile(filename))
1.17 + self.stylesheets.append(libxsltmod.xsltParseStylesheetFile(filename))
1.18
1.19 def __del__(self):
1.20
1.21 @@ -42,7 +42,7 @@
1.22 """
1.23
1.24 for stylesheet in self.stylesheets:
1.25 - stylesheet.freeStylesheet()
1.26 + libxsltmod.xsltFreeStylesheet(stylesheet)
1.27
1.28 def send_output(self, stream, encoding, document):
1.29
1.30 @@ -51,12 +51,10 @@
1.31 the given 'document'.
1.32 """
1.33
1.34 - result = self._get_result(document)
1.35 + result = self.get_result(document)
1.36
1.37 if result is not None:
1.38 - # Since result is a native node, use the serialize method.
1.39 - stream.write(result.serialize(encoding))
1.40 - result.freeDoc()
1.41 + stream.write(result.toString(encoding))
1.42 else:
1.43 raise OutputError, "Transformation failed."
1.44
1.45 @@ -70,7 +68,7 @@
1.46 result = self._get_result(document)
1.47
1.48 if result is not None:
1.49 - return libxml2dom.Node(result)
1.50 + return libxml2dom.adoptNodes([result])[0]
1.51 else:
1.52 raise OutputError, "Transformation failed."
1.53
1.54 @@ -93,10 +91,8 @@
1.55
1.56 last_result = document
1.57 for stylesheet in self.stylesheets:
1.58 - result = stylesheet.applyStylesheet(last_result, parameters)
1.59 + result = libxsltmod.xsltApplyStylesheet(stylesheet, last_result, parameters)
1.60 if last_result is not None:
1.61 - if last_result is not document:
1.62 - last_result.freeDoc()
1.63 last_result = result
1.64 else:
1.65 raise OutputError, "Transformation failed."