summaryrefslogtreecommitdiff
path: root/libexslt
diff options
context:
space:
mode:
authorKasimier T. Buchcik <kbuchcik@src.gnome.org>2006-05-05 21:18:25 +0000
committerKasimier T. Buchcik <kbuchcik@src.gnome.org>2006-05-05 21:18:25 +0000
commiteb037ebd811cbf68dd36a9d5732529aed2e3f2e5 (patch)
tree4797bd02a6275826a587fdde0dba0e1fe9f20cda /libexslt
parent178887dd23630520c793d8b55ef01b3ce55f49c1 (diff)
downloadlibxslt-eb037ebd811cbf68dd36a9d5732529aed2e3f2e5.tar.gz
libxslt-eb037ebd811cbf68dd36a9d5732529aed2e3f2e5.tar.bz2
libxslt-eb037ebd811cbf68dd36a9d5732529aed2e3f2e5.zip
Next step of refactoring (plus some bug-fixes). For more details see
* libxslt/xsltInternals.h libxslt/attributes.c libxslt/documents.c libxslt/extensions.c libxslt/extensions.h libxslt/functions.c libxslt/imports.c libxslt/keys.c libxslt/preproc.c libxslt/transform.c libxslt/variables.c libxslt/xslt.c libxslt/xsltutils.c libxslt/xsltutils.h libexslt/functions.c: Next step of refactoring (plus some bug-fixes). For more details see #340780.
Diffstat (limited to 'libexslt')
-rw-r--r--libexslt/functions.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/libexslt/functions.c b/libexslt/functions.c
index 57e90c4f..51f7d448 100644
--- a/libexslt/functions.c
+++ b/libexslt/functions.c
@@ -128,6 +128,10 @@ exsltFuncRegisterImportFunc (exsltFuncFunctionData *data,
* @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
*/
@@ -170,8 +174,9 @@ exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
* @ctxt: an XSLT transformation context
* @URI: the namespace URI for the extension
* @data: the module data to free up
- *
+ *
* Shutdown the EXSLT - Functions module
+ * Called at transformation-time.
*/
static void
exsltFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
@@ -188,6 +193,7 @@ exsltFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
* @URI: the namespace URI for the extension
*
* Allocates the stylesheet data for EXSLT - Function
+ * Called at compile-time.
*
* Returns the allocated data
*/
@@ -201,9 +207,10 @@ exsltFuncStyleInit (xsltStylesheetPtr style ATTRIBUTE_UNUSED,
* exsltFuncStyleShutdown:
* @style: an XSLT stylesheet
* @URI: the namespace URI for the extension
- * @data: the stylesheet data to free up
+ * @data: the stylesheet data to free up
*
* Shutdown the EXSLT - Function module
+ * Called at compile-time.
*/
static void
exsltFuncStyleShutdown (xsltStylesheetPtr style ATTRIBUTE_UNUSED,
@@ -431,8 +438,19 @@ exsltFuncFunctionComp (xsltStylesheetPtr style, xmlNodePtr inst) {
* Register the function data such that it can be retrieved
* by exslFuncFunctionFunction
*/
- data = (xmlHashTablePtr) xsltStyleGetExtData (style,
- EXSLT_FUNCTIONS_NAMESPACE);
+#ifdef XSLT_REFACTORED
+ /*
+ * Ensure that the hash table will be stored in the *current*
+ * stylesheet level in order to correctly evaluate the
+ * import precedence.
+ */
+ data = (xmlHashTablePtr)
+ xsltStyleStylesheetLevelGetExtData(style,
+ EXSLT_FUNCTIONS_NAMESPACE);
+#else
+ data = (xmlHashTablePtr)
+ xsltStyleGetExtData (style, EXSLT_FUNCTIONS_NAMESPACE);
+#endif
if (data == NULL) {
xsltGenericError(xsltGenericErrorContext,
"exsltFuncFunctionComp: no stylesheet data\n");
@@ -441,9 +459,10 @@ exsltFuncFunctionComp (xsltStylesheetPtr style, xmlNodePtr inst) {
}
if (xmlHashAddEntry2 (data, ns->href, name, func) < 0) {
- xsltGenericError(xsltGenericErrorContext,
- "Failed to register function {%s}%s\n",
+ xsltTransformError(NULL, style, inst,
+ "Failed to register function {%s}%s\n",
ns->href, name);
+ style->errors++;
} else {
xsltGenericDebug(xsltGenericDebugContext,
"exsltFuncFunctionComp: register {%s}%s\n",