Had a desire to use some exslt functions in libxml2 xpath expressions last month, attached is the patch I wrote. It's not really in a finished form, but works well enough, so thought I'd send it to the list rather than forget about it completely. In the grand tradition of bad example code without error checks or cleanup: xmlDocPtr doc = xmlReadDoc((xmlChar*)"<test>2008-11-22</test>", 0, 0, 0); xmlXPathContextPtr ctxt = xmlXPathNewContext(doc); exsltDateXpathCtxtRegister(ctxt, (xmlChar*)"date"); { xmlXPathObjectPtr result = xmlXPathEval((xmlChar*)"date:seconds(/test)", ctxt); /* result->floatval is 1227312000.0 */ } Useful when implementing the same functionality in the host language would be difficult and error prone. Martin
Attachment:
libexslt_for_libxml2.patch
Description: Binary data