From: William M. Brack Date: Mon, 6 Sep 2004 21:29:48 +0000 (+0000) Subject: fixed 2 problems with xsl:include (bug #151795) X-Git-Tag: v1.1.28~386 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53e62821f994bb275cc4a8bfe0c88093c20e0faf;p=platform%2Fupstream%2Flibxslt.git fixed 2 problems with xsl:include (bug #151795) * libxslt/imports.c, libxslt/xslt.c, libxslt/xsltInternals.h: fixed 2 problems with xsl:include (bug #151795) --- diff --git a/ChangeLog b/ChangeLog index 763b31e..c9bd062 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Sep 6 14:27:38 PDT 2004 William Brack + + * libxslt/imports.c, libxslt/xslt.c, libxslt/xsltInternals.h: + fixed 2 problems with xsl:include (bug #151795) + Tue Aug 31 15:45:42 CEST 2004 Daniel Veillard * NEWS configure.in doc/*: Release of libxslt-1.1.10 diff --git a/libxslt/imports.c b/libxslt/imports.c index 21480fb..e1456ba 100644 --- a/libxslt/imports.c +++ b/libxslt/imports.c @@ -189,6 +189,7 @@ xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur) { xsltStylesheetPtr result; xsltDocumentPtr include; xsltDocumentPtr docptr; + int oldNopreproc; if ((cur == NULL) || (style == NULL)) return (ret); @@ -234,7 +235,11 @@ xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur) { /* chain to stylesheet for recursion checking */ include->includes = style->includes; style->includes = include; + oldNopreproc = style->nopreproc; + style->nopreproc = include->preproc; result = xsltParseStylesheetProcess(style, include->doc); + style->nopreproc = oldNopreproc; + include->preproc = 1; style->includes = include->includes; style->doc = oldDoc; if (result == NULL) { diff --git a/libxslt/xslt.c b/libxslt/xslt.c index 6e7727a..e483da3 100644 --- a/libxslt/xslt.c +++ b/libxslt/xslt.c @@ -1739,11 +1739,16 @@ xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template) { prop = xsltGetNsProp(template, (const xmlChar *)"name", XSLT_NAMESPACE); if (prop != NULL) { const xmlChar *URI; + xsltTemplatePtr cur; - if (ret->name != NULL) xmlFree(ret->name); - ret->name = NULL; - if (ret->nameURI != NULL) xmlFree(ret->nameURI); - ret->nameURI = NULL; + if (ret->name != NULL) { + xmlFree(ret->name); + ret->name = NULL; + } + if (ret->nameURI != NULL) { + xmlFree(ret->nameURI); + ret->nameURI = NULL; + } URI = xsltGetQNameURI(template, &prop); if (prop == NULL) { @@ -1761,6 +1766,16 @@ xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template) { ret->nameURI = xmlStrdup(URI); else ret->nameURI = NULL; + cur = ret->next; + while (cur != NULL) { + if (xmlStrEqual(cur->name, prop)) { + xsltTransformError(NULL, style, template, + "xsl:template: error duplicate name '%s'\n", prop); + style->errors++; + goto error; + } + cur = cur->next; + } } } @@ -1959,7 +1974,8 @@ xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) { return(NULL); } xsltParseStylesheetExcludePrefix(ret, cur); - xsltPrecomputeStylesheet(ret, cur); + if (!ret->nopreproc) + xsltPrecomputeStylesheet(ret, cur); if ((IS_XSLT_ELEM(cur)) && ((IS_XSLT_NAME(cur, "stylesheet")) || diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h index 386405c..3629b9a 100644 --- a/libxslt/xsltInternals.h +++ b/libxslt/xsltInternals.h @@ -144,6 +144,7 @@ struct _xsltDocument { xmlDocPtr doc; /* the parsed document */ void *keys; /* key tables storage */ struct _xsltDocument *includes; /* subsidiary includes */ + int preproc; /* pre-processing already done */ }; typedef struct _xsltTransformContext xsltTransformContext; @@ -435,6 +436,10 @@ struct _xsltStylesheet { * if namespace-alias has an alias for the default stylesheet prefix */ const xmlChar *defaultAlias; + /* + * bypass pre-processing (already done) (used in imports) + */ + int nopreproc; }; /*