/** * exsltFuncInit: * @ctxt: an XSLT transformation context * @URI: the namespace URI for the extension * * Initializes the EXSLT - Functions module. * Called at transformation-time; merges all * functions declared in the import tree taking * import precedence into account, i.e. overriding * functions with lower import precedence. * * Returns the data for this transformation */ static exsltFuncData * exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { exsltFuncData *ret; xsltStylesheetPtr tmp; exsltFuncImportRegData ch; xmlHashTablePtr hash; ret = (exsltFuncData *) xmlMalloc (sizeof(exsltFuncData)); if (ret == NULL) { xsltGenericError(xsltGenericErrorContext, "exsltFuncInit: not enough memory\n"); return(NULL); } memset(ret, 0, sizeof(exsltFuncData)); ret->result = NULL; ret->error = 0; ch.hash = (xmlHashTablePtr) xsltStyleGetExtData(ctxt->style, URI); ret->funcs = ch.hash; xmlHashScanFull(ch.hash, (xmlHashScannerFull) exsltFuncRegisterFunc, ctxt); tmp = ctxt->style; ch.ctxt = ctxt; while ((tmp=xsltNextImport(tmp))!=NULL) { hash = xsltGetExtInfo(tmp, URI); if (hash != NULL) { xmlHashScanFull(hash, (xmlHashScannerFull) exsltFuncRegisterImportFunc, &ch); } } return(ret); }
/** * xsltExtElementPreCompTest: * @style: the stylesheet * @inst: the instruction in the stylesheet * * Process a libxslt:test node */ static xsltElemPreCompPtr xsltExtElementPreCompTest(xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function) { xsltElemPreCompPtr ret; if (style == NULL) { xsltTransformError(NULL, NULL, inst, "xsltExtElementTest: no transformation context\n"); return (NULL); } if (testStyleData == NULL) { xsltGenericDebug(xsltGenericDebugContext, "xsltExtElementPreCompTest: not initialized," " calling xsltStyleGetExtData\n"); xsltStyleGetExtData(style, (const xmlChar *) XSLT_TESTPLUGIN_URL); if (testStyleData == NULL) { xsltTransformError(NULL, style, inst, "xsltExtElementPreCompTest: not initialized\n"); if (style != NULL) style->errors++; return (NULL); } } if (inst == NULL) { xsltTransformError(NULL, style, inst, "xsltExtElementPreCompTest: no instruction\n"); if (style != NULL) style->errors++; return (NULL); } ret = xsltNewElemPreComp(style, inst, function); return (ret); }
/** * xsltExtInitTest: * @ctxt: an XSLT transformation context * @URI: the namespace URI for the extension * * A function called at initialization time of an XSLT extension module * * Returns a pointer to the module specific data for this transformation */ static void * xsltExtInitTest(xsltTransformContextPtr ctxt, const xmlChar * URI) { if (testStyleData == NULL) { xsltGenericDebug(xsltGenericErrorContext, "xsltExtInitTest: not initialized," " calling xsltStyleGetExtData\n"); xsltStyleGetExtData(ctxt->style, URI); if (testStyleData == NULL) { xsltTransformError(ctxt, NULL, NULL, "xsltExtInitTest: not initialized\n"); return (NULL); } } if (testData != NULL) { xsltTransformError(ctxt, NULL, NULL, "xsltExtInitTest: already initialized\n"); return (NULL); } testData = (void *) "test data"; xsltGenericDebug(xsltGenericDebugContext, "Registered test plugin module : %s\n", URI); return (testData); }