Re: [xslt] [PATCH][WIP] Using libexslt functions outside of XSLT
- From: Daniel Veillard <veillard redhat com>
- To: The Gnome XSLT library mailing-list <xslt gnome org>
- Subject: Re: [xslt] [PATCH][WIP] Using libexslt functions outside of XSLT
- Date: Thu, 17 Sep 2009 17:35:51 +0200
On Tue, Dec 16, 2008 at 04:39:15PM +0000, Martin (gzlist) wrote:
> 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.
Bahh, it's not a bad idea, I have fixed a couple of things and pushed
thanks :-)
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel veillard com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]