From 58863d7e3eb6aaf5adf77b36ec95b307e53ba9dd Mon Sep 17 00:00:00 2001 From: "William M. Brack" Date: Sun, 12 Jan 2003 22:58:56 +0000 Subject: [PATCH] enhanced previous fix to bug #120684, using excellent suggestion by Daniel * transform.c: enhanced previous fix to bug #120684, using excellent suggestion by Daniel * attributes.c: fixed bug #119583, merging attribute sets from imported stylesheets. * tests/docs/Makefile.am tests/docs/bug-131.xml tests/general/Makefile.am tests/docs/bug-131*: added tests to the regression suite for bug #120684. --- libxslt/attributes.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/libxslt/attributes.c b/libxslt/attributes.c index 85b2e54..58a5d2a 100644 --- a/libxslt/attributes.c +++ b/libxslt/attributes.c @@ -502,6 +502,7 @@ 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) { @@ -510,14 +511,23 @@ xsltMergeSASCallback(xsltAttrElemPtr values, xsltStylesheetPtr style, */ #ifdef WITH_XSLT_DEBUG_ATTRIBUTES xsltGenericDebug(xsltGenericDebugContext, - "attribute sets %s present already in top stylesheet\n", - name); + "attribute set %s present already in top stylesheet" + " - merging\n", name); #endif - xsltFreeAttrElem(values); + 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(topSet, values); + xmlHashUpdateEntry2(style->attributeSets, name, ns, topSet, NULL); + } + xsltFreeAttrElemList(values); #ifdef WITH_XSLT_DEBUG_ATTRIBUTES } else { xsltGenericDebug(xsltGenericDebugContext, - "attribute sets %s moved to top stylesheet\n", + "attribute set %s moved to top stylesheet\n", name); #endif } -- 2.7.4