Re: (no subject)

Noam Postavsky <[email protected]>
Newsgroups gmane.comp.gnome.lib.xslt
Message-ID <[email protected]>
Phil Shafer <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.