make sure to register EXSLT for the bindings add a specific test minor
authorDaniel Veillard <veillard@src.gnome.org>
Sat, 16 Nov 2002 22:26:08 +0000 (22:26 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Sat, 16 Nov 2002 22:26:08 +0000 (22:26 +0000)
* python/libxslt.c: make sure to register EXSLT for the bindings
* python/tests/Makefile.am python/tests/exslt.py: add a specific test
* xsltproc/xsltproc.c: minor cleanup
Daniel

ChangeLog
python/libxslt.c
python/tests/Makefile.am
python/tests/exslt.py [new file with mode: 0755]
xsltproc/xsltproc.c

index 9b41e5e..c529e7c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sat Nov 16 23:23:41 CET 2002 Daniel Veillard <daniel@veillard.com>
+
+       * python/libxslt.c: make sure to register EXSLT for the bindings
+       * python/tests/Makefile.am python/tests/exslt.py: add a specific test
+       * xsltproc/xsltproc.c: minor cleanup
+
 Fri Nov 15 12:35:57 CET 2002 Daniel Veillard <daniel@veillard.com>
 
        * python/Makefile.am python/tests/Makefile.am: trying to fix #98518
index 9ab20f8..7b115a6 100644 (file)
@@ -458,6 +458,10 @@ void initlibxsltmod(void) {
     xmlInitMemory();
     xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
     xmlDefaultSAXHandler.cdataBlock = NULL;
+    /*
+     * Register the EXSLT extensions and the test module
+     */
+    exsltRegisterAll();
 }
 
 
index 0e6cf72..cb7a2f1 100644 (file)
@@ -2,6 +2,7 @@ EXAMPLE_DIR = $(datadir)/doc/libxslt-python-$(LIBXSLT_VERSION)/examples
 
 TESTSPY=       \
     basic.py   \
+    exslt.py   \
     extfunc.py
 
 XMLS=          \
diff --git a/python/tests/exslt.py b/python/tests/exslt.py
new file mode 100755 (executable)
index 0000000..5432347
--- /dev/null
@@ -0,0 +1,57 @@
+#!/usr/bin/python -u
+import sys
+import libxml2
+import libxslt
+
+# Memory debug specific
+libxml2.debugMemory(1)
+
+
+styledoc = libxml2.parseDoc(
+"""<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:str="http://exslt.org/strings"
+    exclude-result-prefixes="str">
+
+<xsl:template match="/">
+<out>;
+  str:tokenize('2001-06-03T11:40:23', '-T:')
+  <xsl:copy-of select="str:tokenize('2001-06-03T11:40:23', '-T:')"/>;
+
+  str:tokenize('date math str')
+  <xsl:copy-of select="str:tokenize('date math str')"/>;
+</out>
+</xsl:template>
+
+</xsl:stylesheet>
+""")
+style = libxslt.parseStylesheetDoc(styledoc)
+doc = libxml2.parseDoc("<doc/>")
+result = style.applyStylesheet(doc, None)
+stringval = style.saveResultToString(result)
+style.freeStylesheet()
+doc.freeDoc()
+result.freeDoc()
+
+expect="""<?xml version="1.0"?>
+<out>;
+  str:tokenize('2001-06-03T11:40:23', '-T:')
+  <token>2001</token><token>06</token><token>03</token><token>11</token><token>40</token><token>23</token>;
+
+  str:tokenize('date math str')
+  <token>date</token><token>math</token><token>str</token>;
+</out>
+"""
+
+if stringval != expect:
+  print "Exslt processing failed"
+  sys.exit(255)
+    
+# Memory debug specific
+libxslt.cleanup()
+if libxml2.debugMemory(1) == 0:
+    print "OK"
+else:
+    print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+    libxml2.dumpMemory()
index a4e2e90..fe1e258 100644 (file)
@@ -172,7 +172,6 @@ xsltprocExternalEntityLoader(const char *URL, const char *ID,
     }
     for (i = 0;i < nbpaths;i++) {
        xmlChar *newURL;
-       int len;
 
        newURL = xmlStrdup((const xmlChar *) paths[i]);
        newURL = xmlStrcat(newURL, (const xmlChar *) "/");