[Lxml-checkins] r43510 - lxml/trunk/src/lxml/tests

scoder at codespeak.net scoder at codespeak.net
Sun May 20 11:37:57 CEST 2007


Author: scoder
Date: Sun May 20 11:37:56 2007
New Revision: 43510

Modified:
   lxml/trunk/src/lxml/tests/test_xslt.py
Log:
exslt test split

Modified: lxml/trunk/src/lxml/tests/test_xslt.py
==============================================================================
--- lxml/trunk/src/lxml/tests/test_xslt.py	(original)
+++ lxml/trunk/src/lxml/tests/test_xslt.py	Sun May 20 11:37:56 2007
@@ -134,19 +134,40 @@
         self.assertEquals(expected,
                           unicode(res))
 
-    def test_exslt(self):
+    def test_exslt_str(self):
         tree = self.parse('<a><b>B</b><c>C</c></a>')
         style = self.parse('''\
 <xsl:stylesheet version="1.0"
-    xmlns:math="http://exslt.org/math"
     xmlns:str="http://exslt.org/strings"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    exclude-result-prefixes="math str xsl">
+    exclude-result-prefixes="str xsl">
   <xsl:template match="text()">
     <xsl:value-of select="str:align(string(.), '---', 'center')" />
   </xsl:template>
   <xsl:template match="*">
     <xsl:copy>
+      <xsl:apply-templates/>
+    </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>''')
+
+        st = etree.XSLT(style)
+        res = st(tree)
+        self.assertEquals('''\
+<?xml version="1.0"?>
+<a><b>-B-</b><c>-C-</c></a>
+''',
+                          str(res))
+
+    def test_exslt_math(self):
+        tree = self.parse('<a><b>B</b><c>C</c></a>')
+        style = self.parse('''\
+<xsl:stylesheet version="1.0"
+    xmlns:math="http://exslt.org/math"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    exclude-result-prefixes="math xsl">
+  <xsl:template match="*">
+    <xsl:copy>
       <xsl:attribute name="pi">
         <xsl:value-of select="math:constant('PI', count(*)+2)"/>
       </xsl:attribute>
@@ -159,7 +180,7 @@
         res = st(tree)
         self.assertEquals('''\
 <?xml version="1.0"?>
-<a pi="3.14"><b pi="3">-B-</b><c pi="3">-C-</c></a>
+<a pi="3.14"><b pi="3">B</b><c pi="3">C</c></a>
 ''',
                           str(res))
 


More information about the lxml-checkins mailing list