[xslt] [patch]debug plugin loading



attached patch adds a few xsltGenericDebug calls to 
xsltExtModuleRegisterDynamic. 

here's the output from a successful test using the command:

LIBXSLT_PLUGINS_PATH=. ../../xsltproc/xsltproc -v plugin.xsl plugin.xml

from the directory: /opt/src/libxslt/tests/plugins

creating dictionary for stylesheet
reusing dictionary from plugin.xsl for stylesheet
Added namespace: xsl mapped to http://www.w3.org/1999/XSL/Transform
Added namespace: libxslt mapped to http://xmlsoft.org/xslt/testplugin
Added namespace: test mapped to http://xmlsoft.org/xslt/testplugin
xsltPrecomputeStylesheet: removing ignorable blank node
xsltParseStylesheetProcess : found stylesheet
add extension prefix libxslt
Registering extension prefix libxslt : http://xmlsoft.org/xslt/testplugin
LIBXSLT_PLUGINS_PATH is .
Attempting to load plugin: ./xmlsoft_org_xslt_testplugin.so for URI: http://xmlsoft.org/xslt/testplugin
Initializing module: http://xmlsoft.org/xslt/testplugin
Registered test plugin module : http://xmlsoft.org/xslt/testplugin
add extension prefix test
Registering extension prefix test : http://xmlsoft.org/xslt/testplugin
xsltCompilePattern : parsing '/'
xsltCompilePattern : parsed /, default priority 0.500000
added pattern : '/' priority 0.500000
parsed 1 templates
Resolving attribute sets references
Registered test plugin module : http://xmlsoft.org/xslt/testplugin
Registered module http://xmlsoft.org/xslt/testplugin
Registered 1 modules
Creating sub-dictionary from stylesheet for transformation
reusing transformation dict for output
Registering global variables
Registering global variables from plugin.xsl
xsltProcessOneNode: applying template '/' for /
xsltApplyOneTemplate: extension construct testplugin
xsltValueOf: select libxslt:testplugin('SUCCESS')
Lookup function {http://xmlsoft.org/xslt/testplugin}testplugin
found function testplugin
xsltCopyTextString: copy text SUCCESS
xsltValueOf: result SUCCESS
Shutting down module : http://xmlsoft.org/xslt/testplugin
Unregistered test plugin module : http://xmlsoft.org/xslt/testplugin
freeing transformation dictionnary
Shutting down module : http://xmlsoft.org/xslt/testplugin
Unregistered test plugin module : http://xmlsoft.org/xslt/testplugin
freeing dictionary from stylesheet

--- libxslt-orig/libxslt/extensions.c	2005-01-15 12:35:23.000000000 -0500
+++ libxslt/libxslt/extensions.c	2005-01-15 12:45:46.000000000 -0500
@@ -357,6 +357,12 @@ xsltExtModuleRegisterDynamic(const xmlCh
 
     /* determine module directory */
     ext_directory = getenv(BAD_CAST "LIBXSLT_PLUGINS_PATH");
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "LIBXSLT_PLUGINS_PATH is %s\n", ext_directory);
+#endif
+
     if (NULL == ext_directory)
         ext_directory = LIBXSLT_DEFAULT_PLUGINS_PATH();
     if (NULL == ext_directory)
@@ -365,7 +371,20 @@ xsltExtModuleRegisterDynamic(const xmlCh
     /* build the module filename, and confirm the module exists */
     xmlStrPrintf(module_filename, sizeof(module_filename), "%s/%s%s",
                  ext_directory, ext_name, LIBXML_MODULE_EXTENSION);
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "Attempting to load plugin: %s for URI: %s\n", 
+                     module_filename, URI);
+#endif
+
     if (1 != xmlCheckFilename(module_filename)) {
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "xmlCheckFilename failed for plugin: %s\n", module_filename);
+#endif
+
       xmlFree(ext_name);
         return (-1);
     }
@@ -373,6 +392,12 @@ xsltExtModuleRegisterDynamic(const xmlCh
     /* attempt to open the module*/
     m = xmlModuleOpen(module_filename, 0);
     if (NULL == m) {
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "xmlModuleOpen failed for plugin: %s\n", module_filename);
+#endif
+
       xmlFree(ext_name);
         return (-1);
     }
@@ -390,6 +415,13 @@ xsltExtModuleRegisterDynamic(const xmlCh
     xmlHashAddEntry(xsltModuleHash, URI, (void *) m);
     }
     else {
+
+#ifdef WITH_XSLT_DEBUG_EXTENSIONS
+    xsltGenericDebug(xsltGenericDebugContext,
+                     "xmlModuleSymbol failed for plugin: %s, regfunc: %s\n", 
+                     module_filename, regfunc_name);
+#endif
+
       /* if regfunc not found unload the module immediately */
       xmlModuleClose(m);
     }


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