diff --git a/libxslt/transform.c b/libxslt/transform.c
index de2ef3c3..35701dea 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -4075,7 +4075,7 @@ xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node,
} else if (xmlStrEqual(prefix, BAD_CAST "xml")) {
prefix = NULL;
}
- } else if (prefix != NULL) {
+ } else {
xmlNsPtr ns;
/*
* SPEC XSLT 1.0:
@@ -4090,11 +4090,13 @@ xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node,
* TODO: Check this in the compilation layer in case it's a
* static value.
*/
- xsltTransformError(ctxt, NULL, inst,
- "xsl:element: The QName '%s:%s' has no "
- "namespace binding in scope in the stylesheet; "
- "this is an error, since the namespace was not "
- "specified by the instruction itself.\n", prefix, name);
+ if (prefix != NULL) {
+ xsltTransformError(ctxt, NULL, inst,
+ "xsl:element: The QName '%s:%s' has no "
+ "namespace binding in scope in the stylesheet; "
+ "this is an error, since the namespace was not "
+ "specified by the instruction itself.\n", prefix, name);
+ }
} else
nsName = ns->href;
}
diff --git a/tests/docs/Makefile.am b/tests/docs/Makefile.am
index 9e2204ff..12a97a8a 100644
--- a/tests/docs/Makefile.am
+++ b/tests/docs/Makefile.am
@@ -168,6 +168,7 @@ EXTRA_DIST = \
bug-167.xml \
bug-168.xml \
bug-169.xml \
+ bug-179.xml \
character.xml \
array.xml \
items.xml
diff --git a/tests/docs/bug-179.xml b/tests/docs/bug-179.xml
new file mode 100644
index 00000000..69d62f2c
--- /dev/null
+++ b/tests/docs/bug-179.xml
@@ -0,0 +1 @@
+
diff --git a/tests/general/Makefile.am b/tests/general/Makefile.am
index 364fdd9d..762eca9f 100644
--- a/tests/general/Makefile.am
+++ b/tests/general/Makefile.am
@@ -186,6 +186,7 @@ EXTRA_DIST = \
bug-176.out bug-176.xsl \
bug-177.out bug-177.xsl \
bug-178.out bug-178.xsl \
+ bug-179.out bug-179.xsl \
character.out character.xsl \
character2.out character2.xsl \
itemschoose.out itemschoose.xsl \
diff --git a/tests/general/bug-179.out b/tests/general/bug-179.out
new file mode 100644
index 00000000..0a7e67d1
--- /dev/null
+++ b/tests/general/bug-179.out
@@ -0,0 +1,9 @@
+
+
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+
diff --git a/tests/general/bug-179.xsl b/tests/general/bug-179.xsl
new file mode 100644
index 00000000..5847e9a0
--- /dev/null
+++ b/tests/general/bug-179.xsl
@@ -0,0 +1,24 @@
+
+
+baz
+
+
+
+
+
+ ...
+ ...
+
+
+ ...
+ ...
+ ...
+
+
+ ...
+
+
+
+
+