From cc0e7a04fd44b0618c11c16cc603a69432faddd4 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Thu, 7 Mar 2002 16:03:34 +0000 Subject: [PATCH] fixed bug #73791 related to extension function declared in included * libxslt/extensions.c: fixed bug #73791 related to extension function declared in included stylesheets * tests/exslt/functions/function.7.*: added specific test Daniel --- ChangeLog | 6 ++++++ libexslt/functions.c | 1 + libxslt/extensions.c | 27 +++++++++++++++++++-------- tests/exslt/functions/function.7.out | 2 ++ tests/exslt/functions/function.7.xml | 26 ++++++++++++++++++++++++++ tests/exslt/functions/function.7.xsl | 13 +++++++++++++ 6 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 tests/exslt/functions/function.7.out create mode 100644 tests/exslt/functions/function.7.xml create mode 100644 tests/exslt/functions/function.7.xsl diff --git a/ChangeLog b/ChangeLog index a251c173..4cd83e9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Mar 7 17:01:21 CET 2002 Daniel Veillard + + * libxslt/extensions.c: fixed bug #73791 related to extension + function declared in included stylesheets + * tests/exslt/functions/function.7.*: added specific test + Thu Mar 7 15:20:32 CET 2002 Daniel Veillard * tests/docs/Makefile.am tests/docs/bug-75.xml diff --git a/libexslt/functions.c b/libexslt/functions.c index d3eba075..9f92914c 100644 --- a/libexslt/functions.c +++ b/libexslt/functions.c @@ -311,6 +311,7 @@ exsltFuncFunctionComp (xsltStylesheetPtr style, xmlNodePtr inst) { if ((style == NULL) || (inst == NULL)) return; + { xmlChar *qname; diff --git a/libxslt/extensions.c b/libxslt/extensions.c index 879e956d..ba127cf9 100644 --- a/libxslt/extensions.c +++ b/libxslt/extensions.c @@ -406,17 +406,28 @@ xsltFreeCtxtExts(xsltTransformContextPtr ctxt) { */ void * xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar * URI) { - xsltExtDataPtr data; + xsltExtDataPtr data = NULL; + xsltStylesheetPtr tmp; + if ((style == NULL) || (URI == NULL)) return (NULL); - if (style->extInfos == NULL) { - style->extInfos = xmlHashCreate(10); - if (style->extInfos == NULL) - return(NULL); - data = NULL; - } else { - data = (xsltExtDataPtr) xmlHashLookup(style->extInfos, URI); + + tmp = style; + while (tmp != NULL) { + if (tmp->extInfos != NULL) { + data = (xsltExtDataPtr) xmlHashLookup(tmp->extInfos, URI); + if (data != NULL) + break; + } + tmp = xsltNextImport(tmp); + } + if (data == NULL) { + if (style->extInfos == NULL) { + style->extInfos = xmlHashCreate(10); + if (style->extInfos == NULL) + return(NULL); + } } if (data == NULL) { void *extData; diff --git a/tests/exslt/functions/function.7.out b/tests/exslt/functions/function.7.out new file mode 100644 index 00000000..b55429fc --- /dev/null +++ b/tests/exslt/functions/function.7.out @@ -0,0 +1,2 @@ + +17 diff --git a/tests/exslt/functions/function.7.xml b/tests/exslt/functions/function.7.xml new file mode 100644 index 00000000..bd4128df --- /dev/null +++ b/tests/exslt/functions/function.7.xml @@ -0,0 +1,26 @@ + + + +
+
+

Hello

+

Hello again.

+
+
+
+

Hello2

+
+

Hello

+

Hello again.

+
+
+

Hello

+

Hello again.

+
+

Hello2 again.

+
+

Hello

+

Hello again.

+
+
+
diff --git a/tests/exslt/functions/function.7.xsl b/tests/exslt/functions/function.7.xsl new file mode 100644 index 00000000..fa057e9b --- /dev/null +++ b/tests/exslt/functions/function.7.xsl @@ -0,0 +1,13 @@ + + + + + + + + + + + +