diff --git a/key.patch b/key.patch new file mode 100644 index 0000000..d79936e --- /dev/null +++ b/key.patch @@ -0,0 +1,217 @@ +Index: libxslt/keys.c +=================================================================== +--- libxslt/keys.c (revision 1450) ++++ libxslt/keys.c (revision 1451) +@@ -393,9 +393,11 @@ xsltGetKey(xsltTransformContextPtr ctxt, + const xmlChar *nameURI, const xmlChar *value) { + xmlNodeSetPtr ret; + xsltKeyTablePtr table; ++#if 0 + #ifdef XSLT_REFACTORED_KEYCOMP + int found = 0; + #endif ++#endif + + if ((ctxt == NULL) || (name == NULL) || (value == NULL) || + (ctxt->document == NULL)) +@@ -406,20 +408,23 @@ xsltGetKey(xsltTransformContextPtr ctxt, + "Get key %s, value %s\n", name, value); + #endif + ++#ifdef XSLT_REFACTORED_KEYCOMP ++ if (xsltInitAllDocKeys(ctxt)) ++ return(NULL); ++#endif ++ + table = (xsltKeyTablePtr) ctxt->document->keys; + while (table != NULL) { + if (((nameURI != NULL) == (table->nameURI != NULL)) && + xmlStrEqual(table->name, name) && + xmlStrEqual(table->nameURI, nameURI)) + { +-#ifdef XSLT_REFACTORED_KEYCOMP +- found = 1; +-#endif + ret = (xmlNodeSetPtr)xmlHashLookup(table->keys, value); + return(ret); + } + table = table->next; + } ++#if 0 + #ifdef XSLT_REFACTORED_KEYCOMP + if (! found) { + xsltStylesheetPtr style = ctxt->style; +@@ -464,6 +469,7 @@ xsltGetKey(xsltTransformContextPtr ctxt, + } + } + #endif ++#endif + return(NULL); + } + +@@ -553,6 +559,77 @@ xsltEvalXPathKeys(xsltTransformContextPt + } + #endif + ++#ifdef XSLT_REFACTORED_KEYCOMP ++/** ++ * xsltInitAllDocKeys: ++ * ++ * INTERNAL ROUTINE ONLY ++ * ++ * Check if any keys on the current document need to be computed ++ */ ++int ++xsltInitAllDocKeys(xsltTransformContextPtr ctxt) ++{ ++ xsltStylesheetPtr style, style2; ++ xsltKeyDefPtr keyd, keyd2; ++ xsltKeyTablePtr table; ++ ++ if (ctxt == NULL) ++ return(-1); ++ ++ if (ctxt->document->nbKeysComputed == ctxt->nbKeys) ++ return(0); ++ /* ++ * TODO: This could be further optimized ++ */ ++ style = ctxt->style; ++ while (style) { ++ keyd = (xsltKeyDefPtr) style->keys; ++ while (keyd != NULL) { ++ /* ++ * Check if keys with this QName have been already ++ * computed. ++ */ ++ table = (xsltKeyTablePtr) ctxt->document->keys; ++ while (table) { ++ if (((keyd->nameURI != NULL) == (table->nameURI != NULL)) && ++ xmlStrEqual(keyd->name, table->name) && ++ xmlStrEqual(keyd->nameURI, table->nameURI)) ++ { ++ break; ++ } ++ table = table->next; ++ } ++ if (table == NULL) { ++ /* ++ * Keys with this QName have not been yet computed. ++ */ ++ style2 = ctxt->style; ++ while (style2 != NULL) { ++ keyd2 = (xsltKeyDefPtr) style2->keys; ++ while (keyd2 != NULL) { ++ if (((keyd2->nameURI != NULL) == ++ (keyd->nameURI != NULL)) && ++ xmlStrEqual(keyd2->name, keyd->name) && ++ xmlStrEqual(keyd2->nameURI, keyd->nameURI)) ++ { ++ xsltInitCtxtKey(ctxt, ctxt->document, keyd2); ++ if (ctxt->document->nbKeysComputed == ctxt->nbKeys) ++ return(0); ++ } ++ keyd2 = keyd2->next; ++ } ++ style2 = xsltNextImport(style2); ++ } ++ } ++ keyd = keyd->next; ++ } ++ style = xsltNextImport(style); ++ } ++ return(0); ++} ++#endif ++ + /** + * xsltInitCtxtKey: + * @ctxt: an XSLT transformation context +Index: libxslt/xsltInternals.h +=================================================================== +--- libxslt/xsltInternals.h (revision 1450) ++++ libxslt/xsltInternals.h (revision 1451) +@@ -1958,7 +1958,8 @@ XSLTPUBFUN int XSLTCALL + xsltInitCtxtKey (xsltTransformContextPtr ctxt, + xsltDocumentPtr doc, + xsltKeyDefPtr keyd); +- ++XSLTPUBFUN int XSLTCALL ++ xsltInitAllDocKeys (xsltTransformContextPtr ctxt); + #ifdef __cplusplus + } + #endif +Index: libxslt/pattern.c +=================================================================== +--- libxslt/pattern.c (revision 1450) ++++ libxslt/pattern.c (revision 1451) +@@ -2242,10 +2242,6 @@ xsltAddTemplate(xsltStylesheetPtr style, + static int + xsltComputeAllKeys(xsltTransformContextPtr ctxt, xmlNodePtr contextNode) + { +- xsltStylesheetPtr style, style2; +- xsltKeyDefPtr keyd, keyd2; +- xsltKeyTablePtr table; +- + if ((ctxt == NULL) || (contextNode == NULL)) { + xsltTransformError(ctxt, NULL, ctxt->inst, + "Internal error in xsltComputeAllKeys(): " +@@ -2266,57 +2262,7 @@ xsltComputeAllKeys(xsltTransformContextP + if (ctxt->document == NULL) + return(-1); + } +- +- if (ctxt->document->nbKeysComputed == ctxt->nbKeys) +- return(0); +- /* +- * TODO: This could be further optimized +- */ +- style = ctxt->style; +- while (style) { +- keyd = (xsltKeyDefPtr) style->keys; +- while (keyd != NULL) { +- /* +- * Check if keys with this QName have been already +- * computed. +- */ +- table = (xsltKeyTablePtr) ctxt->document->keys; +- while (table) { +- if (((keyd->nameURI != NULL) == (table->nameURI != NULL)) && +- xmlStrEqual(keyd->name, table->name) && +- xmlStrEqual(keyd->nameURI, table->nameURI)) +- { +- break; +- } +- table = table->next; +- } +- if (table == NULL) { +- /* +- * Keys with this QName have not been yet computed. +- */ +- style2 = ctxt->style; +- while (style2 != NULL) { +- keyd2 = (xsltKeyDefPtr) style2->keys; +- while (keyd2 != NULL) { +- if (((keyd2->nameURI != NULL) == +- (keyd->nameURI != NULL)) && +- xmlStrEqual(keyd2->name, keyd->name) && +- xmlStrEqual(keyd2->nameURI, keyd->nameURI)) +- { +- xsltInitCtxtKey(ctxt, ctxt->document, keyd2); +- if (ctxt->document->nbKeysComputed == ctxt->nbKeys) +- return(0); +- } +- keyd2 = keyd2->next; +- } +- style2 = xsltNextImport(style2); +- } +- } +- keyd = keyd->next; +- } +- style = xsltNextImport(style); +- } +- return(0); ++ return xsltInitAllDocKeys(ctxt); + + doc_info_mismatch: + xsltTransformError(ctxt, NULL, ctxt->inst, diff --git a/libxslt.spec b/libxslt.spec index 4317356..c545d89 100644 --- a/libxslt.spec +++ b/libxslt.spec @@ -1,7 +1,7 @@ Summary: Library providing the Gnome XSLT engine Name: libxslt Version: 1.1.23 -Release: 1%{?dist}%{?extra_release} +Release: 2%{?dist}%{?extra_release} License: MIT Group: Development/Libraries Source: ftp://xmlsoft.org/XSLT/libxslt-%{version}.tar.gz @@ -15,6 +15,7 @@ BuildRequires: libgcrypt-devel Prefix: %{_prefix} Docdir: %{_docdir} Patch0: multilib.patch +Patch1: key.patch %description This C library allows to transform XML files into other XML files @@ -56,6 +57,7 @@ with XPath functions written in Python. %prep %setup -q %patch0 -p1 +%patch1 -R -p0 %build %configure @@ -122,6 +124,10 @@ rm -fr %{buildroot} %doc python/tests/*.xsl %changelog +* Tue Apr 22 2008 Daniel Veillard 1.1.23-2.fc10 +- revert a key initialization patch from 1.1.23 which seems broken + see rhbz#442097 + * Tue Apr 8 2008 Daniel Veillard 1.1.23-1.fc9 - upstream release 1.1.23 - bugfixes