summaryrefslogtreecommitdiff
path: root/libexslt/strings.c
diff options
context:
space:
mode:
authorMartin <gzlist@googlemail.com>2009-09-17 16:54:18 +0200
committerDaniel Veillard <veillard@redhat.com>2009-09-17 16:54:18 +0200
commitce169a52f485dbf5522c0668e2975201b179add7 (patch)
treebf54bf74a0e518855b6502e6deb5a8cfb78ca554 /libexslt/strings.c
parent3d435b25cf2e8112d87cb133c00b94d5924ec75c (diff)
downloadlibxslt-ce169a52f485dbf5522c0668e2975201b179add7.tar.gz
libxslt-ce169a52f485dbf5522c0668e2975201b179add7.tar.bz2
libxslt-ce169a52f485dbf5522c0668e2975201b179add7.zip
Allow use of EXSLT outside XSLT
* libexslt/exslt.h libexslt/date.c libexslt/math.c libexslt/sets.c libexslt/strings.c: provide registration function for an XPath context directly
Diffstat (limited to 'libexslt/strings.c')
-rw-r--r--libexslt/strings.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/libexslt/strings.c b/libexslt/strings.c
index 192d0c4a..1a11976c 100644
--- a/libexslt/strings.c
+++ b/libexslt/strings.c
@@ -673,3 +673,45 @@ exsltStrRegister (void) {
EXSLT_STRINGS_NAMESPACE,
exsltStrReplaceFunction);
}
+
+/**
+ * exsltStrXpathCtxtRegister:
+ *
+ * Registers the EXSLT - Strings module for use outside XSLT
+ */
+int
+exsltStrXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix)
+{
+ if (ctxt
+ && prefix
+ && !xmlXPathRegisterNs(ctxt,
+ prefix,
+ (const xmlChar *) EXSLT_STRINGS_NAMESPACE)
+ && !xmlXPathRegisterFuncNS(ctxt,
+ (const xmlChar *) "encode-uri",
+ (const xmlChar *) EXSLT_STRINGS_NAMESPACE,
+ exsltStrEncodeUriFunction)
+ && !xmlXPathRegisterFuncNS(ctxt,
+ (const xmlChar *) "decode-uri",
+ (const xmlChar *) EXSLT_STRINGS_NAMESPACE,
+ exsltStrDecodeUriFunction)
+ && !xmlXPathRegisterFuncNS(ctxt,
+ (const xmlChar *) "padding",
+ (const xmlChar *) EXSLT_STRINGS_NAMESPACE,
+ exsltStrPaddingFunction)
+ && !xmlXPathRegisterFuncNS(ctxt,
+ (const xmlChar *) "align",
+ (const xmlChar *) EXSLT_STRINGS_NAMESPACE,
+ exsltStrAlignFunction)
+ && !xmlXPathRegisterFuncNS(ctxt,
+ (const xmlChar *) "concat",
+ (const xmlChar *) EXSLT_STRINGS_NAMESPACE,
+ exsltStrConcatFunction)
+ && !xmlXPathRegisterFuncNS(ctxt,
+ (const xmlChar *) "replace",
+ (const xmlChar *) EXSLT_STRINGS_NAMESPACE,
+ exsltStrReplaceFunction)) {
+ return 0;
+ }
+ return -1;
+}