Re: [xslt] (no subject)



Phil Shafer <phil juniper net> writes:

> Denis Davidov writes:
>>Create new dict using xmlDictCreate and then fill it with
>> xmlDictLookup - correct?
>
> IIRC the dict is used automagikally.

I seem to remember Daniel Veillard mentioning that this only happens
with the newer xmlReadFile() functions, but not with xmlParseFile().

>
>>Could you show me how could I set my node as the context node? I've
>> tried to replace xmlXPathContextPtr->node with my node, but the
>> program crashed (while my ugly method works fine).

I have an example of this in XMLStarlet [1], it's essentially

    xmlNodePtr ctxt_node = ctxt->node; // save original context node

    for (i = 0; i < nodes->nodeNr; i++)
    {
        ctxt->node = nodes->nodeTab[i]; // set new context node
        // get result of XPath expression
        res = xmlXPathConvertString(xmlXPathCompiledEval(xpath, ctxt));
        ...
    }

    ctxt->node = ctxt_node; // restore original context node



[1] http://xmlstar.git.sourceforge.net/git/gitweb.cgi?p=xmlstar/xmlstar;a=blob;f=src/xml_edit.c;hb=1.3.1#l245


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]