summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam M. Brack <wbrack@src.gnome.org>2004-09-06 21:29:48 +0000
committerWilliam M. Brack <wbrack@src.gnome.org>2004-09-06 21:29:48 +0000
commit53e62821f994bb275cc4a8bfe0c88093c20e0faf (patch)
tree913f0ed28b6264d4a7082b89b775c6f68b1a466a
parente8b9a3d880ab72f748b6eb01a92ae2c910753d2f (diff)
downloadlibxslt-53e62821f994bb275cc4a8bfe0c88093c20e0faf.tar.gz
libxslt-53e62821f994bb275cc4a8bfe0c88093c20e0faf.tar.bz2
libxslt-53e62821f994bb275cc4a8bfe0c88093c20e0faf.zip
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)
-rw-r--r--ChangeLog5
-rw-r--r--libxslt/imports.c5
-rw-r--r--libxslt/xslt.c26
-rw-r--r--libxslt/xsltInternals.h5
4 files changed, 36 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 763b31e0..c9bd0629 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Sep 6 14:27:38 PDT 2004 William Brack <wbrack@mmm.com.hk>
+
+ * 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 <daniel@veillard.com>
* NEWS configure.in doc/*: Release of libxslt-1.1.10
diff --git a/libxslt/imports.c b/libxslt/imports.c
index 21480fbe..e1456baf 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 6e7727ab..e483da37 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 386405c2..3629b9a9 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;
};
/*