RE: [xslt] str:tokenize behavior

>   Hum, there is 2 options:
>     - either this must behave like a node set, an in this case the
>       nodeset should contain the list of nodes not, the 
> parent document
>       element
>     - or check in xsltForEach for the boolean bit of the XPATH_NODESET
>       nodeset object, and if there is only one node, it's a doc with
>       the "fake" name then process at the children level.
> Seems to me the first option is the most coherent.

So if I'm understanding option one correctly it would look something like

container = xmlNewDoc(NULL);
if (container != NULL) {
 container->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt");
 container->doc = container;
 ret = xmlXPathNewValueTree(NULL);
 if (ret != NULL) {
   /* Create your RTF nodes here */
   xmlNodePtr cur = xmlNewChild((xmlNodePtr) container,NULL,"token",NULL);
   if (cur) xmlXPathNodeSetAdd(ret->nodesetval,cur);

The nodes would get freed properly because ret->user = container

Also, if this is hte approach, wouldn't exsl:node-set need to be modified to
added the children nodes of 'container' to hte nodeset (and remove container
itself) when converting from XPATH_XSLT_TREE to XPATH_NODESET?

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