summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2001-07-09 13:59:13 +0000
committerDaniel Veillard <veillard@src.gnome.org>2001-07-09 13:59:13 +0000
commit399ff26ba4e515ad84279edda8e173cb5f0b2543 (patch)
tree71fc7bd3b2777dd3f380bbce1b4be4f74565f2e2
parent451c656c3b1553c3c7caf4785d67c628bdb8f425 (diff)
downloadlibxslt-399ff26ba4e515ad84279edda8e173cb5f0b2543.tar.gz
libxslt-399ff26ba4e515ad84279edda8e173cb5f0b2543.tar.bz2
libxslt-399ff26ba4e515ad84279edda8e173cb5f0b2543.zip
fixed exclude-result-prefixes handling and how namespaces propagate from
* libxslt/transform.c libxslt/xslt.c libxslt/xsltInternals.h: fixed exclude-result-prefixes handling and how namespaces propagate from the stylesheet to the result in general, this is a serious cleanup. * tests/general/bug-3[67]-inc.xsl tests/general/bug-6-.xsl tests/general/itemschoose.out tests/namespaces/extra.xsl tests/REC/test-10-1.xsl tests/REC/test-10-2.xsl tests/REC/test-11.2-1.xsl tests/REC/test-11.2-2.xsl tests/REC/test-11.2-6.xsl tests/REC/test-15-1.xsl tests/REC/test-16.1-1.xsl tests/REC/test-16.1-2.xsl tests/REC/test-5.4-1.out tests/REC/test-5.4-2.out tests/REC/test-5.4-3.out tests/REC/test-5.4-4.out tests/REC/test-7.1.1-2.out tests/REC/test-7.1.1-2.xsl tests/REC/test-7.1.1-3.out tests/REC/test-7.1.1-3.xsl tests/REC/test-7.1.1.out tests/REC/test-7.1.3.xsl tests/REC/test-7.3.xsl tests/REC/test-7.4.xsl tests/REC/test-7.6.1-1.xsl tests/REC/test-7.6.1-2.xsl tests/REC/test-7.6.1-3.xsl tests/REC/test-7.6.2-1.xsl: fixed and rechecked all the tests where the namespace propagation was wrong either taht the rules were not applied correctly or that superfluous namespaces were declared in the stylesheets Daniel
-rw-r--r--ChangeLog25
-rw-r--r--libxslt/transform.c42
-rw-r--r--libxslt/xslt.c141
-rw-r--r--libxslt/xsltInternals.h3
-rw-r--r--tests/REC/test-10-1.xsl3
-rw-r--r--tests/REC/test-10-2.xsl3
-rw-r--r--tests/REC/test-11.2-1.xsl3
-rw-r--r--tests/REC/test-11.2-2.xsl3
-rw-r--r--tests/REC/test-11.2-6.xsl3
-rw-r--r--tests/REC/test-15-1.xsl1
-rw-r--r--tests/REC/test-16.1-1.xsl1
-rw-r--r--tests/REC/test-16.1-2.xsl1
-rw-r--r--tests/REC/test-5.4-1.out6
-rw-r--r--tests/REC/test-5.4-2.out4
-rw-r--r--tests/REC/test-5.4-3.out4
-rw-r--r--tests/REC/test-5.4-4.out6
-rw-r--r--tests/REC/test-7.1.1-2.out2
-rw-r--r--tests/REC/test-7.1.1-2.xsl10
-rw-r--r--tests/REC/test-7.1.1-3.out2
-rw-r--r--tests/REC/test-7.1.1-3.xsl10
-rw-r--r--tests/REC/test-7.1.1.out12
-rw-r--r--tests/REC/test-7.1.3.xsl1
-rw-r--r--tests/REC/test-7.3.xsl1
-rw-r--r--tests/REC/test-7.4.xsl1
-rw-r--r--tests/REC/test-7.6.1-1.xsl4
-rw-r--r--tests/REC/test-7.6.1-2.xsl4
-rw-r--r--tests/REC/test-7.6.1-3.xsl3
-rw-r--r--tests/REC/test-7.6.2-1.xsl4
-rw-r--r--tests/general/bug-36-inc.xsl1
-rw-r--r--tests/general/bug-37-inc.xsl1
-rw-r--r--tests/general/bug-6-.xsl3
-rw-r--r--tests/general/itemschoose.out16
-rw-r--r--tests/namespaces/extra.xsl1
33 files changed, 251 insertions, 74 deletions
diff --git a/ChangeLog b/ChangeLog
index ba22f580..899d88ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+Mon Jul 9 15:55:14 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+ * libxslt/transform.c libxslt/xslt.c libxslt/xsltInternals.h:
+ fixed exclude-result-prefixes handling and how namespaces
+ propagate from the stylesheet to the result in general, this
+ is a serious cleanup.
+ * tests/general/bug-3[67]-inc.xsl tests/general/bug-6-.xsl
+ tests/general/itemschoose.out tests/namespaces/extra.xsl
+ tests/REC/test-10-1.xsl tests/REC/test-10-2.xsl
+ tests/REC/test-11.2-1.xsl tests/REC/test-11.2-2.xsl
+ tests/REC/test-11.2-6.xsl tests/REC/test-15-1.xsl
+ tests/REC/test-16.1-1.xsl tests/REC/test-16.1-2.xsl
+ tests/REC/test-5.4-1.out tests/REC/test-5.4-2.out
+ tests/REC/test-5.4-3.out tests/REC/test-5.4-4.out
+ tests/REC/test-7.1.1-2.out tests/REC/test-7.1.1-2.xsl
+ tests/REC/test-7.1.1-3.out tests/REC/test-7.1.1-3.xsl
+ tests/REC/test-7.1.1.out tests/REC/test-7.1.3.xsl
+ tests/REC/test-7.3.xsl tests/REC/test-7.4.xsl
+ tests/REC/test-7.6.1-1.xsl tests/REC/test-7.6.1-2.xsl
+ tests/REC/test-7.6.1-3.xsl tests/REC/test-7.6.2-1.xsl:
+ fixed and rechecked all the tests where the namespace
+ propagation was wrong either taht the rules were not applied
+ correctly or that superfluous namespaces were declared in the
+ stylesheets
+
Sun Jul 8 22:12:02 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* libxslt/extra.c libxslt/functions.c libxslt/transform.[ch]
diff --git a/libxslt/transform.c b/libxslt/transform.c
index b1096f17..948585dd 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -500,7 +500,9 @@ xsltCopyNode(xsltTransformContextPtr ctxt, xmlNodePtr node,
if (node->nsDef != NULL)
xsltCopyNamespaceList(ctxt, copy, node->nsDef);
}
- if (node->ns != NULL) {
+ if (((node->type == XML_ELEMENT_NODE) ||
+ (node->type == XML_ATTRIBUTE_NODE)) &&
+ (node->ns != NULL)) {
copy->ns = xsltGetNamespace(ctxt, node, node->ns, copy);
}
} else {
@@ -1166,6 +1168,41 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
attrs = xsltAttrListTemplateProcess(ctxt, copy,
cur->properties);
}
+ /*
+ * Add extra namespaces inherited from the current template
+ * if we are in the first level children
+ */
+ if ((oldInsert == insert) && (ctxt->templ != NULL) &&
+ (ctxt->templ->inheritedNs != NULL)) {
+ int i;
+ xmlNsPtr ns, ret;
+
+ for (i = 0;i < ctxt->templ->inheritedNsNr;i++) {
+ ns = ctxt->templ->inheritedNs[i];
+ if (ctxt->style->nsAliases != NULL) {
+ const xmlChar *URI;
+ URI = (const xmlChar *)
+ xmlHashLookup(ctxt->style->nsAliases,
+ ns->href);
+ if (URI == NULL) {
+ ret = xmlSearchNs(copy->doc, copy, ns->prefix);
+ if ((ret == NULL) ||
+ (!xmlStrEqual(ret->href, ns->href)))
+ xmlNewNs(copy, ns->href, ns->prefix);
+ } else if (!xmlStrEqual(URI, XSLT_NAMESPACE)) {
+ ret = xmlSearchNs(copy->doc, copy, ns->prefix);
+ if ((ret == NULL) ||
+ (!xmlStrEqual(ret->href, URI)))
+ xmlNewNs(copy, URI, ns->prefix);
+ }
+ } else {
+ ret = xmlSearchNs(copy->doc, copy, ns->prefix);
+ if ((ret == NULL) ||
+ (!xmlStrEqual(ret->href, ns->href)))
+ xmlNewNs(copy, ns->href, ns->prefix);
+ }
+ }
+ }
}
/*
@@ -3368,7 +3405,8 @@ xsltRegisterAllElement(xsltTransformContextPtr ctxt)
xsltRegisterExtElement(ctxt, (const xmlChar *) "copy-of",
XSLT_NAMESPACE, xsltCopyOf);
xsltRegisterExtElement(ctxt, (const xmlChar *) "message",
- XSLT_NAMESPACE, xsltMessage);
+ XSLT_NAMESPACE,
+ (xsltTransformFunction) xsltMessage);
/*
* Those don't have callable entry points but are registered anyway
diff --git a/libxslt/xslt.c b/libxslt/xslt.c
index bc1f3125..acc291da 100644
--- a/libxslt/xslt.c
+++ b/libxslt/xslt.c
@@ -273,6 +273,7 @@ xsltFreeTemplate(xsltTemplatePtr template) {
if (template->nameURI) xmlFree(template->nameURI);
if (template->mode) xmlFree(template->mode);
if (template->modeURI) xmlFree(template->modeURI);
+ if (template->inheritedNs) xmlFree(template->inheritedNs);
memset(template, -1, sizeof(xsltTemplate));
xmlFree(template);
}
@@ -404,6 +405,91 @@ xsltFreeStylesheet(xsltStylesheetPtr sheet)
************************************************************************/
/**
+ * xsltGetInheritedNsList:
+ * @style: the stylesheet
+ * @template: the template
+ * @node: the current node
+ *
+ * Search all the namespace applying to a given element except the ones
+ * from excluded output prefixes currently in scope. Initialize the
+ * template inheritedNs list with it.
+ *
+ * Returns the number of entries found
+ */
+static int
+xsltGetInheritedNsList(xsltStylesheetPtr style,
+ xsltTemplatePtr template,
+ xmlNodePtr node)
+{
+ xmlNsPtr cur;
+ xmlNsPtr *ret = NULL;
+ int nbns = 0;
+ int maxns = 10;
+ int i;
+
+ if ((style == NULL) || (template == NULL) || (node == NULL) ||
+ (template->inheritedNsNr != 0) || (template->inheritedNs != NULL))
+ return(0);
+ while (node != NULL) {
+ if (node->type == XML_ELEMENT_NODE) {
+ cur = node->nsDef;
+ while (cur != NULL) {
+ if (xmlStrEqual(cur->href, XSLT_NAMESPACE))
+ goto skip_ns;
+ for (i = 0;i < style->exclPrefixNr;i++) {
+ if (xmlStrEqual(cur->href, style->exclPrefixTab[i]))
+ goto skip_ns;
+ }
+ if (ret == NULL) {
+ ret =
+ (xmlNsPtr *) xmlMalloc((maxns + 1) *
+ sizeof(xmlNsPtr));
+ if (ret == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlGetNsList : out of memory!\n");
+ return(0);
+ }
+ ret[nbns] = NULL;
+ }
+ for (i = 0; i < nbns; i++) {
+ if ((cur->prefix == ret[i]->prefix) ||
+ (xmlStrEqual(cur->prefix, ret[i]->prefix)))
+ break;
+ }
+ if (i >= nbns) {
+ if (nbns >= maxns) {
+ maxns *= 2;
+ ret = (xmlNsPtr *) xmlRealloc(ret,
+ (maxns +
+ 1) *
+ sizeof(xmlNsPtr));
+ if (ret == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlGetNsList : realloc failed!\n");
+ return(0);
+ }
+ }
+ ret[nbns++] = cur;
+ ret[nbns] = NULL;
+ }
+skip_ns:
+ cur = cur->next;
+ }
+ }
+ node = node->parent;
+ }
+ if (nbns != 0) {
+#ifdef WITH_XSLT_DEBUG_PARSING
+ xsltGenericDebug(xsltGenericDebugContext,
+ "template has %d inherited namespaces\n", nbns);
+#endif
+ template->inheritedNsNr = nbns;
+ template->inheritedNs = ret;
+ }
+ return (nbns);
+}
+
+/**
* xsltParseStylesheetOutput:
* @style: the XSLT stylesheet
* @cur: the "output" element
@@ -958,18 +1044,42 @@ xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) {
/*
* Remove excluded prefixes
*/
- if ((cur->ns != NULL) && (style->exclPrefixNr > 0)) {
- int i;
-
- for (i = 0;i < style->exclPrefixNr;i++) {
- if (xmlStrEqual(cur->ns->href, style->exclPrefixTab[i])) {
- for (;exclPrefixes > 0;exclPrefixes--)
- prefix = exclPrefixPop(style);
- delete = cur;
- goto skip_children;
+ if ((cur->nsDef != NULL) && (style->exclPrefixNr > 0)) {
+ xmlNsPtr ns = cur->nsDef, prev = NULL, next;
+ xmlNodePtr root = NULL;
+ int i, moved;
+
+ root = xmlDocGetRootElement(cur->doc);
+ if ((root != NULL) && (root != cur)) {
+ while (ns != NULL) {
+ moved = 0;
+ next = ns->next;
+ for (i = 0;i < style->exclPrefixNr;i++) {
+ if (xmlStrEqual(ns->href,
+ style->exclPrefixTab[i])) {
+ /*
+ * Move the namespace definition on the root
+ * element to avoid duplicating it without
+ * loosing it.
+ */
+ if (prev == NULL) {
+ cur->nsDef = ns->next;
+ } else {
+ prev->next = ns->next;
+ }
+ ns->next = root->nsDef;
+ root->nsDef = ns;
+ moved = 1;
+ break;
+ }
+ }
+ if (moved == 0)
+ prev = ns;
+ ns = next;
}
}
}
+
/*
* If we have prefixes locally, recurse and pop them up when
* going back
@@ -1379,6 +1489,7 @@ xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template) {
xmlChar *mode = NULL;
xmlChar *modeURI = NULL;
double priority;
+ int exclPrefixes;
if (template == NULL)
return;
@@ -1394,6 +1505,16 @@ xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template) {
ret->style = style;
/*
+ * Check excluded prefixes
+ */
+ exclPrefixes = xsltParseStylesheetExcludePrefix(style, template);
+
+ /*
+ * Get inherited namespaces
+ */
+ xsltGetInheritedNsList(style, ret, template);
+
+ /*
* Get arguments
*/
prop = xsltGetNsProp(template, (const xmlChar *)"mode", XSLT_NAMESPACE);
@@ -1459,6 +1580,8 @@ xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template) {
xsltAddTemplate(style, ret, mode, modeURI);
error:
+ for (;exclPrefixes > 0;exclPrefixes--)
+ exclPrefixPop(style);
if (mode != NULL)
xmlFree(mode);
if (modeURI != NULL)
diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h
index 71c02640..a2689ad1 100644
--- a/libxslt/xsltInternals.h
+++ b/libxslt/xsltInternals.h
@@ -55,6 +55,9 @@ struct _xsltTemplate {
xmlNodePtr content; /* the template replacement value */
xmlNodePtr elem; /* the source element */
+ int inheritedNsNr; /* number of inherited namespaces */
+ xmlNsPtr *inheritedNs;/* inherited non-excluded namespaces */
+
/* Profiling informations */
int nbCalls; /* the number of time the template was called */
unsigned long time; /* the time spent in this template */
diff --git a/tests/REC/test-10-1.xsl b/tests/REC/test-10-1.xsl
index 613c4f33..4e952f7c 100644
--- a/tests/REC/test-10-1.xsl
+++ b/tests/REC/test-10-1.xsl
@@ -1,6 +1,5 @@
<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="employees">
<ul>
<xsl:apply-templates select="employee">
diff --git a/tests/REC/test-10-2.xsl b/tests/REC/test-10-2.xsl
index 613c4f33..4e952f7c 100644
--- a/tests/REC/test-10-2.xsl
+++ b/tests/REC/test-10-2.xsl
@@ -1,6 +1,5 @@
<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="employees">
<ul>
<xsl:apply-templates select="employee">
diff --git a/tests/REC/test-11.2-1.xsl b/tests/REC/test-11.2-1.xsl
index b2a0c994..f066e931 100644
--- a/tests/REC/test-11.2-1.xsl
+++ b/tests/REC/test-11.2-1.xsl
@@ -1,6 +1,5 @@
<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="x"/>
diff --git a/tests/REC/test-11.2-2.xsl b/tests/REC/test-11.2-2.xsl
index b631a961..680f5dff 100644
--- a/tests/REC/test-11.2-2.xsl
+++ b/tests/REC/test-11.2-2.xsl
@@ -1,6 +1,5 @@
<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="x" select="''"/>
diff --git a/tests/REC/test-11.2-6.xsl b/tests/REC/test-11.2-6.xsl
index db59e1d2..1a4a9a20 100644
--- a/tests/REC/test-11.2-6.xsl
+++ b/tests/REC/test-11.2-6.xsl
@@ -1,6 +1,5 @@
<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="x" select="/.."/>
diff --git a/tests/REC/test-15-1.xsl b/tests/REC/test-15-1.xsl
index 524f1e6f..920a268e 100644
--- a/tests/REC/test-15-1.xsl
+++ b/tests/REC/test-15-1.xsl
@@ -2,6 +2,7 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:test="http://example.org/"
xsl:extension-element-prefixes="test"
+ exclude-result-prefixes="test"
version='1.0'>
<xsl:template match="/">
<test:test>
diff --git a/tests/REC/test-16.1-1.xsl b/tests/REC/test-16.1-1.xsl
index 98a2b3ae..f82204ee 100644
--- a/tests/REC/test-16.1-1.xsl
+++ b/tests/REC/test-16.1-1.xsl
@@ -1,6 +1,5 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:test="http://example.org/"
version='1.0'>
<xsl:output cdata-section-elements="example"/>
diff --git a/tests/REC/test-16.1-2.xsl b/tests/REC/test-16.1-2.xsl
index 0e8c82d4..1e296ecb 100644
--- a/tests/REC/test-16.1-2.xsl
+++ b/tests/REC/test-16.1-2.xsl
@@ -1,6 +1,5 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:test="http://example.org/"
version='1.0'>
<xsl:output cdata-section-elements="example"/>
diff --git a/tests/REC/test-5.4-1.out b/tests/REC/test-5.4-1.out
index d4db6019..c89a4a1c 100644
--- a/tests/REC/test-5.4-1.out
+++ b/tests/REC/test-5.4-1.out
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
-<doc>
-<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<doc xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:block>
This is a chapter
</fo:block>
-<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format">This is another chapter</fo:block>
+<fo:block>This is another chapter</fo:block>
</doc>
diff --git a/tests/REC/test-5.4-2.out b/tests/REC/test-5.4-2.out
index 2e32bff5..fe0af52b 100644
--- a/tests/REC/test-5.4-2.out
+++ b/tests/REC/test-5.4-2.out
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
-<doc>
-<fo:inline-sequence xmlns:fo="http://www.w3.org/1999/XSL/Format">name1name2</fo:inline-sequence>
+<doc xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:inline-sequence>name1name2</fo:inline-sequence>
</doc>
diff --git a/tests/REC/test-5.4-3.out b/tests/REC/test-5.4-3.out
index 2e32bff5..fe0af52b 100644
--- a/tests/REC/test-5.4-3.out
+++ b/tests/REC/test-5.4-3.out
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
-<doc>
-<fo:inline-sequence xmlns:fo="http://www.w3.org/1999/XSL/Format">name1name2</fo:inline-sequence>
+<doc xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:inline-sequence>name1name2</fo:inline-sequence>
</doc>
diff --git a/tests/REC/test-5.4-4.out b/tests/REC/test-5.4-4.out
index 43191ba3..caecb147 100644
--- a/tests/REC/test-5.4-4.out
+++ b/tests/REC/test-5.4-4.out
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
-<doc><fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<doc xmlns:fo="http://www.w3.org/1999/XSL/Format"><fo:block>
Employee employee1 belongs to group
- group1</fo:block><fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ group1</fo:block><fo:block>
Employee employee3 belongs to group
- group1</fo:block><fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ group1</fo:block><fo:block>
Employee employee2 belongs to group
group2</fo:block></doc>
diff --git a/tests/REC/test-7.1.1-2.out b/tests/REC/test-7.1.1-2.out
index 965f7cdd..29c31b70 100644
--- a/tests/REC/test-7.1.1-2.out
+++ b/tests/REC/test-7.1.1-2.out
@@ -1,2 +1,2 @@
<?xml version="1.0"?>
-<doc>SUCCESS</doc>
+<out>SUCCESS</out>
diff --git a/tests/REC/test-7.1.1-2.xsl b/tests/REC/test-7.1.1-2.xsl
index 84cfe39f..12ca7be4 100644
--- a/tests/REC/test-7.1.1-2.xsl
+++ b/tests/REC/test-7.1.1-2.xsl
@@ -1,11 +1,13 @@
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:doc="http://example.org/doc">
+ xmlns:doc="http://example.org/doc"
+ exclude-result-prefixes="doc">
-<xsl:template exclude-result-prefixes="doc" match="/">
-<doc:tst>FAILURE</doc:tst>
-<doc>SUCCESS</doc>
+<doc:doc>Some ignored documentation the prefix should not show
+ up on the doc element</doc:doc>
+<xsl:template match="/">
+<out>SUCCESS</out>
</xsl:template>
</xsl:stylesheet>
diff --git a/tests/REC/test-7.1.1-3.out b/tests/REC/test-7.1.1-3.out
index 09a5eea1..29c31b70 100644
--- a/tests/REC/test-7.1.1-3.out
+++ b/tests/REC/test-7.1.1-3.out
@@ -1,2 +1,2 @@
<?xml version="1.0"?>
-<tst>SUCCESS</tst>
+<out>SUCCESS</out>
diff --git a/tests/REC/test-7.1.1-3.xsl b/tests/REC/test-7.1.1-3.xsl
index 68e75402..d4a72b93 100644
--- a/tests/REC/test-7.1.1-3.xsl
+++ b/tests/REC/test-7.1.1-3.xsl
@@ -1,12 +1,12 @@
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:doc="http://example.org/doc"
- exclude-result-prefixes="doc" >
+ xmlns:doc="http://example.org/doc">
-<xsl:template match="/">
-<doc:tst>FAILURE</doc:tst>
-<tst>SUCCESS</tst>
+<doc:doc>Some ignored documentation the prefix should not show
+ up on the doc element</doc:doc>
+<xsl:template xsl:exclude-result-prefixes="doc" match="/">
+<out>SUCCESS</out>
</xsl:template>
</xsl:stylesheet>
diff --git a/tests/REC/test-7.1.1.out b/tests/REC/test-7.1.1.out
index f21cf90e..f66406d6 100644
--- a/tests/REC/test-7.1.1.out
+++ b/tests/REC/test-7.1.1.out
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
-<axsl:stylesheet xmlns:axsl="http://www.w3.org/1999/XSL/Transform">
-<axsl:template match="p"><fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"><axsl:apply-templates/></fo:block></axsl:template>
-<axsl:template match="h1"><fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"><axsl:apply-templates/></fo:block></axsl:template>
-<axsl:template match="h2"><fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"><axsl:apply-templates/></fo:block></axsl:template>
-<axsl:template match="h3"><fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"><axsl:apply-templates/></fo:block></axsl:template>
-<axsl:template match="h4"><fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"><axsl:apply-templates/></fo:block></axsl:template>
+<axsl:stylesheet xmlns:axsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<axsl:template match="p"><fo:block><axsl:apply-templates/></fo:block></axsl:template>
+<axsl:template match="h1"><fo:block><axsl:apply-templates/></fo:block></axsl:template>
+<axsl:template match="h2"><fo:block><axsl:apply-templates/></fo:block></axsl:template>
+<axsl:template match="h3"><fo:block><axsl:apply-templates/></fo:block></axsl:template>
+<axsl:template match="h4"><fo:block><axsl:apply-templates/></fo:block></axsl:template>
</axsl:stylesheet>
diff --git a/tests/REC/test-7.1.3.xsl b/tests/REC/test-7.1.3.xsl
index e54f6f38..36d5b752 100644
--- a/tests/REC/test-7.1.3.xsl
+++ b/tests/REC/test-7.1.3.xsl
@@ -1,7 +1,6 @@
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">
<xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>
diff --git a/tests/REC/test-7.3.xsl b/tests/REC/test-7.3.xsl
index 3f699f11..2f5675c0 100644
--- a/tests/REC/test-7.3.xsl
+++ b/tests/REC/test-7.3.xsl
@@ -1,7 +1,6 @@
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">
<xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>
diff --git a/tests/REC/test-7.4.xsl b/tests/REC/test-7.4.xsl
index 80594735..8e9cdff2 100644
--- a/tests/REC/test-7.4.xsl
+++ b/tests/REC/test-7.4.xsl
@@ -1,7 +1,6 @@
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">
<xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>
diff --git a/tests/REC/test-7.6.1-1.xsl b/tests/REC/test-7.6.1-1.xsl
index 75150b46..b74aaf3d 100644
--- a/tests/REC/test-7.6.1-1.xsl
+++ b/tests/REC/test-7.6.1-1.xsl
@@ -1,8 +1,6 @@
<xsl:stylesheet
version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format"
- xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="person">
<p>
diff --git a/tests/REC/test-7.6.1-2.xsl b/tests/REC/test-7.6.1-2.xsl
index 4404557b..0bc12a6a 100644
--- a/tests/REC/test-7.6.1-2.xsl
+++ b/tests/REC/test-7.6.1-2.xsl
@@ -1,8 +1,6 @@
<xsl:stylesheet
version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format"
- xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="person">
<p>
diff --git a/tests/REC/test-7.6.1-3.xsl b/tests/REC/test-7.6.1-3.xsl
index 6e8cdd7a..edba6f58 100644
--- a/tests/REC/test-7.6.1-3.xsl
+++ b/tests/REC/test-7.6.1-3.xsl
@@ -1,8 +1,7 @@
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format"
- xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">
+ xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="procedure">
<fo:block>
diff --git a/tests/REC/test-7.6.2-1.xsl b/tests/REC/test-7.6.2-1.xsl
index 83414b52..4eb9a805 100644
--- a/tests/REC/test-7.6.2-1.xsl
+++ b/tests/REC/test-7.6.2-1.xsl
@@ -1,8 +1,6 @@
<xsl:stylesheet
version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format"
- xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="image-dir">/images</xsl:variable>
diff --git a/tests/general/bug-36-inc.xsl b/tests/general/bug-36-inc.xsl
index 54949a5d..9605c886 100644
--- a/tests/general/bug-36-inc.xsl
+++ b/tests/general/bug-36-inc.xsl
@@ -1,6 +1,7 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:n="http://xmlsoft.org/"
+ xsl:exclude-result-prefixes="n"
version='1.0'>
<xsl:variable name="var" select="/n:x" />
diff --git a/tests/general/bug-37-inc.xsl b/tests/general/bug-37-inc.xsl
index fdbae5f8..4da21d5e 100644
--- a/tests/general/bug-37-inc.xsl
+++ b/tests/general/bug-37-inc.xsl
@@ -1,6 +1,7 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:n="http://xmlsoft.org/"
+ xsl:exclude-result-prefixes="n"
version='1.0'>
<xsl:template match="/">
diff --git a/tests/general/bug-6-.xsl b/tests/general/bug-6-.xsl
index 33100d78..6d11881e 100644
--- a/tests/general/bug-6-.xsl
+++ b/tests/general/bug-6-.xsl
@@ -3,7 +3,8 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:my="http://my/namespace"
- xmlns="http://www.w3.org/1999/xhtml">
+ xmlns="http://www.w3.org/1999/xhtml"
+ exclude-result-prefixes="my">
<!-- Root Node -->
<xsl:template match="/">
diff --git a/tests/general/itemschoose.out b/tests/general/itemschoose.out
index 36e4084e..5ebd98ab 100644
--- a/tests/general/itemschoose.out
+++ b/tests/general/itemschoose.out
@@ -1,13 +1,13 @@
<?xml version="1.0"?>
-<doc>
+<doc xmlns:fo="http://www.w3.org/1999/XSL/Format">
- <fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem1</fo:list-item-body></fo:list-item>
- <fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem2</fo:list-item-body></fo:list-item>
- <fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem3</fo:list-item-body></fo:list-item>
- <fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem4</fo:list-item-body></fo:list-item>
- <fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem5</fo:list-item-body></fo:list-item>
- <fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem6</fo:list-item-body></fo:list-item>
- <fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>
+ <fo:list-item indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem1</fo:list-item-body></fo:list-item>
+ <fo:list-item indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem2</fo:list-item-body></fo:list-item>
+ <fo:list-item indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem3</fo:list-item-body></fo:list-item>
+ <fo:list-item indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem4</fo:list-item-body></fo:list-item>
+ <fo:list-item indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem5</fo:list-item-body></fo:list-item>
+ <fo:list-item indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem6</fo:list-item-body></fo:list-item>
+ <fo:list-item indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="a"/>. </fo:list-item-label><fo:list-item-body>
diff --git a/tests/namespaces/extra.xsl b/tests/namespaces/extra.xsl
index c1fd3df7..fec3a0f6 100644
--- a/tests/namespaces/extra.xsl
+++ b/tests/namespaces/extra.xsl
@@ -1,6 +1,5 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns="http://www.w3.org/TR/xhtml1/strict"
xmlns:libxml="http://xmlsoft.org/XSLT/namespace">
<xsl:template match="/">