Re: calling EXSLT function str:replace() without transform context raises memory error in 1.1.27

Nick Wellnhofer <[email protected]> Fri, 28 Sep 2012 17:44:03 +0200
Newsgroups gmane.comp.gnome.lib.xslt
Message-ID <[email protected]>
On 28/09/2012 17:12, Nick Wellnhofer wrote:
> The str:tokenize and str:split function do the same thing btw, although
> it seems that they don't raise an error, but simply return an empty node
> set when used without a transform context.

I just realized that str:tokenize and str:split aren't registered in 
exsltStrXpathCtxtRegister for that reason. It seems that 
node-set-returning functions simply won't work outside of libxslt. So I 
see no other solution than to remove str:replace, too. See the attached 
patch.

Nick

_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
https://mail.gnome.org/mailman/listinfo/xslt
dont-register-str-replace.patch (text/plain, 829 B)
diff --git a/libexslt/strings.c b/libexslt/strings.c
index 045cc14..c0c7a18 100644
--- a/libexslt/strings.c
+++ b/libexslt/strings.c
@@ -838,11 +838,7 @@ exsltStrXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix)
         && !xmlXPathRegisterFuncNS(ctxt,
                                    (const xmlChar *) "concat",
                                    (const xmlChar *) EXSLT_STRINGS_NAMESPACE,
-                                   exsltStrConcatFunction)
-        && !xmlXPathRegisterFuncNS(ctxt,
-                                   (const xmlChar *) "replace",
-                                   (const xmlChar *) EXSLT_STRINGS_NAMESPACE,
-                                   exsltStrReplaceFunction)) {
+                                   exsltStrConcatFunction)) {
         return 0;
     }
     return -1;