ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

xsltExtensionInstructionResultRegister: : an XSLT transformation context : an XPath object to be inspected for result tree fragments

Marks the result of a value-returning extension instruction in order to avoid it being garbage collected before the extension instruction exits. Note that one still has to additionally register any newly created tree fragments (via xsltCreateRVT()) with xsltRegisterLocalRVT().

Returns 0 in case of success and -1 in case of error.

Definition at line 243 of file variables.c.

{
    int i;
    xmlNodePtr cur;
    xmlDocPtr doc;

    if ((ctxt == NULL) || (obj == NULL))
    return(-1);

    /*
    * OPTIMIZE TODO: If no local variables/params and no local tree
    * fragments were created, then we don't need to analyse the XPath
    * objects for tree fragments.
    */

    if ((obj->type != XPATH_NODESET) && (obj->type != XPATH_XSLT_TREE))
    return(0);
    if ((obj->nodesetval == NULL) || (obj->nodesetval->nodeNr == 0))
    return(0);

    for (i = 0; i < obj->nodesetval->nodeNr; i++) {
    cur = obj->nodesetval->nodeTab[i];
    if (cur->type == XML_NAMESPACE_DECL) {
        /*
        * The XPath module sets the owner element of a ns-node on
        * the ns->next field.
        */
        if ((((xmlNsPtr) cur)->next != NULL) &&
        (((xmlNsPtr) cur)->next->type == XML_ELEMENT_NODE))
        {
        cur = (xmlNodePtr) ((xmlNsPtr) cur)->next;
        doc = cur->doc; 
        } else {
        xsltTransformError(ctxt, NULL, ctxt->inst,
            "Internal error in "
            "xsltExtensionInstructionResultRegister(): "
            "Cannot retrieve the doc of a namespace node.\n");
        goto error;
        }
    } else {
        doc = cur->doc;
    }
    if (doc == NULL) {
        xsltTransformError(ctxt, NULL, ctxt->inst,
        "Internal error in "
        "xsltExtensionInstructionResultRegister(): "
        "Cannot retrieve the doc of a node.\n");
        goto error;
    }
    if (doc->name && (doc->name[0] == ' ')) {
        /*
        * This is a result tree fragment.
        * We'll use the @psvi field for reference counting.
        * TODO: How do we know if this is a value of a
        *  global variable or a doc acquired via the
        *  document() function?
        */
        doc->psvi = (void *) ((long) 1);
    }
    }

    return(0);
error:
    return(-1);
}

Generated on Sun May 27 2012 04:50:17 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.