Esempio n. 1
0
/**
 * xsltMergeSASCallback,:
 * @style:  the XSLT stylesheet
 *
 * Merge an attribute set from an imported stylesheet.
 */
static void
xsltMergeSASCallback(xsltAttrElemPtr values, xsltStylesheetPtr style,
                     const xmlChar *name, const xmlChar *ns,
                     ATTRIBUTE_UNUSED const xmlChar *ignored) {
    int ret;
    xsltAttrElemPtr topSet;

    ret = xmlHashAddEntry2(style->attributeSets, name, ns, values);
    if (ret < 0) {
        /*
         * Add failed, this attribute set can be removed.
         */
#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
        xsltGenericDebug(xsltGenericDebugContext,
                         "attribute set %s present already in top stylesheet"
                         " - merging\n", name);
#endif
        topSet = xmlHashLookup2(style->attributeSets, name, ns);
        if (topSet==NULL) {
            xsltGenericError(xsltGenericErrorContext,
                             "xsl:attribute-set : logic error merging from imports for"
                             " attribute-set %s\n", name);
        } else {
            topSet = xsltMergeAttrElemList(style, topSet, values);
            xmlHashUpdateEntry2(style->attributeSets, name, ns, topSet, NULL);
        }
        xsltFreeAttrElemList(values);
#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
    } else {
        xsltGenericDebug(xsltGenericDebugContext,
                         "attribute set %s moved to top stylesheet\n",
                         name);
#endif
    }
}
Esempio n. 2
0
/**
 * xsltFreeAttrSet:
 * @set:  an attribute set
 *
 * Free memory allocated by @set
 */
static void
xsltFreeAttrSet(xsltAttrSetPtr set) {
    if (set == NULL)
        return;

    xsltFreeAttrElemList(set->attrs);
    xsltFreeUseAttrSetList(set->useAttrSets);
    xmlFree(set);
}