[4suite-checkins] In 4Suite/Ft/Xml/Xslt, files CopyElement.py, Processor.py, __init__.py

Jeremy Kloth jkloth at 4suite.org
Fri Nov 24 15:47:36 MST 2006


Modified Files:
    CopyElement.py Processor.py __init__.py

Log Message:
Fixed various bug uncovered by the test suite.

ViewCVS diff:
  http://cvs.4suite.org/viewcvs/4Suite/Ft/Xml/Xslt/CopyElement.py.diff?r1=1.9&r2=1.10
ViewCVS view:
  http://cvs.4suite.org/viewcvs/4Suite/Ft/Xml/Xslt/CopyElement.py?rev=1.10&content-type=text/vnd.viewcvs-markup

Index: CopyElement.py
===================================================================
RCS file: /var/local/cvsroot/4Suite/Ft/Xml/Xslt/CopyElement.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -U2 -r1.9 -r1.10
--- CopyElement.py	29 Jul 2006 18:08:55 -0000	1.9
+++ CopyElement.py	24 Nov 2006 22:47:35 -0000	1.10
@@ -29,4 +29,5 @@
     def instantiate(self, context, processor):
         context.processorNss = self.namespaces
+        context.currentInstruction = self
         
         node = context.node
ViewCVS diff:
  http://cvs.4suite.org/viewcvs/4Suite/Ft/Xml/Xslt/Processor.py.diff?r1=1.79&r2=1.80
ViewCVS view:
  http://cvs.4suite.org/viewcvs/4Suite/Ft/Xml/Xslt/Processor.py?rev=1.80&content-type=text/vnd.viewcvs-markup

Index: Processor.py
===================================================================
RCS file: /var/local/cvsroot/4Suite/Ft/Xml/Xslt/Processor.py,v
retrieving revision 1.79
retrieving revision 1.80
diff -U2 -r1.79 -r1.80
--- Processor.py	24 Nov 2006 22:04:11 -0000	1.79
+++ Processor.py	24 Nov 2006 22:47:36 -0000	1.80
@@ -20,5 +20,5 @@
 from Ft.Xml.Lib import StripElements
 from Ft.Xml.XPath import RuntimeException as XPathRuntimeException
-from Ft.Xml.Xslt import Error, MessageSource, XsltException, XsltRuntimeException
+from Ft.Xml.Xslt import Error, MessageSource, XsltException
 from Ft.Xml.Xslt import XsltContext, OutputHandler, RtfWriter, StringWriter
 from Ft.Xml.Xslt.StylesheetReader import StylesheetReader
@@ -730,10 +730,5 @@
                 instruction.columnNumber, instruction.nodeName, strerror)
             raise
-        except XsltRuntimeException, e:
-            instruction = context.currentInstruction
-            strerror = MessageSource.g_errorMessages[e.errorCode] % e.params
-            e.message = MessageSource.EXPRESSION_POSITION_INFO % (
-                instruction.baseUri, instruction.lineNumber,
-                instruction.columnNumber, instruction.nodeName, strerror)
+        except XsltException:
             raise
         except (KeyboardInterrupt, SystemExit):
@@ -979,11 +974,11 @@
                     params[k] = to_unicode(v)
                 elif isinstance(v, list) and isinstance(v[0], (str, unicode)):
-                    writer = self.pushResultTree(self.stylesheet.baseUri)
+                    doc = self._domimp.createRootNode(self.stylesheet.baseUri)
+                    nodeset = []
                     for text in v:
                         if isinstance(text, str):
                             text = to_unicode(text)
-                        writer.text(text)
-                    doc = self.popResult()
-                    params[k] = list(doc)
+                        nodeset.append(doc.createTextNode(text))
+                    params[k] = nodeset
         return
 
ViewCVS diff:
  http://cvs.4suite.org/viewcvs/4Suite/Ft/Xml/Xslt/__init__.py.diff?r1=1.40&r2=1.41
ViewCVS view:
  http://cvs.4suite.org/viewcvs/4Suite/Ft/Xml/Xslt/__init__.py?rev=1.41&content-type=text/vnd.viewcvs-markup

Index: __init__.py
===================================================================
RCS file: /var/local/cvsroot/4Suite/Ft/Xml/Xslt/__init__.py,v
retrieving revision 1.40
retrieving revision 1.41
diff -U2 -r1.40 -r1.41
--- __init__.py	24 Aug 2006 19:32:54 -0000	1.40
+++ __init__.py	24 Nov 2006 22:47:36 -0000	1.41
@@ -72,6 +72,7 @@
         line = xsltelement.lineNumber or '?'
         col = xsltelement.columnNumber or '?'
-        msg = MessageSource.POSITION_INFO % (baseUri, line, col, self.message)
-        self.message = msg
+        self.message = MessageSource.EXPRESSION_POSITION_INFO % (
+            xsltelement.baseUri, xsltelement.lineNumber, xsltelement.columnNumber,
+            xsltelement.nodeName, self.message)
         return
 


More information about the 4suite-checkins mailing list