[libxslt] Fix xsl:strip-space with namespace and wildcard
- From: Daniel Veillard <veillard src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libxslt] Fix xsl:strip-space with namespace and wildcard
- Date: Wed, 16 Sep 2009 16:53:19 +0000 (UTC)
commit a1fff8aaf099c294b6d3a757dbb4b06bfd42674a
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Wed Sep 16 18:51:29 2009 +0200
Fix xsl:strip-space with namespace and wildcard
* libxslt/imports.c: xsl:strip-space didn't work if there is a NameTest
with a namespace and a wildcard
* tests/REC/Makefile.am tests/REC/test-3.4-*: add some test to the
regression suite
libxslt/imports.c | 7 ++++++-
tests/REC/Makefile.am | 3 +++
tests/REC/test-3.4-1.out | 2 ++
tests/REC/test-3.4-1.xml | 14 ++++++++++++++
tests/REC/test-3.4-1.xsl | 11 +++++++++++
tests/REC/test-3.4-2.out | 2 ++
tests/REC/test-3.4-2.xml | 14 ++++++++++++++
tests/REC/test-3.4-2.xsl | 11 +++++++++++
tests/REC/test-3.4-3.out | 2 ++
tests/REC/test-3.4-3.xml | 14 ++++++++++++++
tests/REC/test-3.4-3.xsl | 11 +++++++++++
11 files changed, 90 insertions(+), 1 deletions(-)
---
diff --git a/libxslt/imports.c b/libxslt/imports.c
index 8ff9f3d..23538ab 100644
--- a/libxslt/imports.c
+++ b/libxslt/imports.c
@@ -348,6 +348,11 @@ xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt, xmlNodePtr node) {
if (node->ns != NULL) {
val = (const xmlChar *)
xmlHashLookup2(style->stripSpaces, node->name, node->ns->href);
+ if (val == NULL) {
+ val = (const xmlChar *)
+ xmlHashLookup2(style->stripSpaces, BAD_CAST "*",
+ node->ns->href);
+ }
} else {
val = (const xmlChar *)
xmlHashLookup2(style->stripSpaces, node->name, NULL);
@@ -357,7 +362,7 @@ xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt, xmlNodePtr node) {
return(1);
if (xmlStrEqual(val, (xmlChar *) "preserve"))
return(0);
- }
+ }
if (style->stripAll == 1)
return(1);
if (style->stripAll == -1)
diff --git a/tests/REC/Makefile.am b/tests/REC/Makefile.am
index 1b42cbd..2c372db 100644
--- a/tests/REC/Makefile.am
+++ b/tests/REC/Makefile.am
@@ -19,6 +19,9 @@ EXTRA_DIST = \
test-16.1-2.out test-16.1-2.xml test-16.1-2.xsl \
test-2.3-1.out test-2.3-1.xml test-2.3-1.xsl \
test-2.3-2.out test-2.3-2.xml test-2.3-2.xsl \
+ test-3.4-1.out test-3.4-1.xml test-3.4-1.xsl \
+ test-3.4-2.out test-3.4-2.xml test-3.4-2.xsl \
+ test-3.4-3.out test-3.4-3.xml test-3.4-3.xsl \
test-2.5-1.out test-2.5-1.xml test-2.5-1.xsl test-2.5-1.err \
test-2.6.2-1.out test-2.6.2-1.xml test-2.6.2-1.xsl \
test-5.2-1.out test-5.2-1.xml test-5.2-1.xsl \
diff --git a/tests/REC/test-3.4-1.out b/tests/REC/test-3.4-1.out
new file mode 100644
index 0000000..9787c95
--- /dev/null
+++ b/tests/REC/test-3.4-1.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+ test01 test02 test11 test12 test11 test12
diff --git a/tests/REC/test-3.4-1.xml b/tests/REC/test-3.4-1.xml
new file mode 100644
index 0000000..83e94bd
--- /dev/null
+++ b/tests/REC/test-3.4-1.xml
@@ -0,0 +1,14 @@
+<doc>
+ <container>
+ <element1> <child>test01</child> </element1>
+ <element2> <child>test02</child> </element2>
+ </container>
+ <foo1:container xmlns:foo1="urn:foo1">
+ <foo1:element1> <foo1:child>test11</foo1:child> </foo1:element1>
+ <foo1:element2> <foo1:child>test12</foo1:child> </foo1:element2>
+ </foo1:container>
+ <foo2:container xmlns:foo2="urn:foo2">
+ <foo2:element1> <foo2:child>test11</foo2:child> </foo2:element1>
+ <foo2:element2> <foo2:child>test12</foo2:child> </foo2:element2>
+ </foo2:container>
+</doc>
diff --git a/tests/REC/test-3.4-1.xsl b/tests/REC/test-3.4-1.xsl
new file mode 100644
index 0000000..78b4759
--- /dev/null
+++ b/tests/REC/test-3.4-1.xsl
@@ -0,0 +1,11 @@
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:foo1="urn:foo1"
+ xmlns:foo2="urn:foo2"
+>
+ <xsl:strip-space elements="foo1:element1"/>
+ <xsl:template match="doc">
+ <xsl:apply-templates select="*/*"/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/tests/REC/test-3.4-2.out b/tests/REC/test-3.4-2.out
new file mode 100644
index 0000000..5864dba
--- /dev/null
+++ b/tests/REC/test-3.4-2.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+ test01 test02 test11test12 test11 test12
diff --git a/tests/REC/test-3.4-2.xml b/tests/REC/test-3.4-2.xml
new file mode 100644
index 0000000..83e94bd
--- /dev/null
+++ b/tests/REC/test-3.4-2.xml
@@ -0,0 +1,14 @@
+<doc>
+ <container>
+ <element1> <child>test01</child> </element1>
+ <element2> <child>test02</child> </element2>
+ </container>
+ <foo1:container xmlns:foo1="urn:foo1">
+ <foo1:element1> <foo1:child>test11</foo1:child> </foo1:element1>
+ <foo1:element2> <foo1:child>test12</foo1:child> </foo1:element2>
+ </foo1:container>
+ <foo2:container xmlns:foo2="urn:foo2">
+ <foo2:element1> <foo2:child>test11</foo2:child> </foo2:element1>
+ <foo2:element2> <foo2:child>test12</foo2:child> </foo2:element2>
+ </foo2:container>
+</doc>
diff --git a/tests/REC/test-3.4-2.xsl b/tests/REC/test-3.4-2.xsl
new file mode 100644
index 0000000..0f46d6c
--- /dev/null
+++ b/tests/REC/test-3.4-2.xsl
@@ -0,0 +1,11 @@
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:foo1="urn:foo1"
+ xmlns:foo2="urn:foo2"
+>
+ <xsl:strip-space elements="foo1:*"/>
+ <xsl:template match="doc">
+ <xsl:apply-templates select="*/*"/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/tests/REC/test-3.4-3.out b/tests/REC/test-3.4-3.out
new file mode 100644
index 0000000..9b9cdf3
--- /dev/null
+++ b/tests/REC/test-3.4-3.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+test01test02test11test12test11test12
diff --git a/tests/REC/test-3.4-3.xml b/tests/REC/test-3.4-3.xml
new file mode 100644
index 0000000..83e94bd
--- /dev/null
+++ b/tests/REC/test-3.4-3.xml
@@ -0,0 +1,14 @@
+<doc>
+ <container>
+ <element1> <child>test01</child> </element1>
+ <element2> <child>test02</child> </element2>
+ </container>
+ <foo1:container xmlns:foo1="urn:foo1">
+ <foo1:element1> <foo1:child>test11</foo1:child> </foo1:element1>
+ <foo1:element2> <foo1:child>test12</foo1:child> </foo1:element2>
+ </foo1:container>
+ <foo2:container xmlns:foo2="urn:foo2">
+ <foo2:element1> <foo2:child>test11</foo2:child> </foo2:element1>
+ <foo2:element2> <foo2:child>test12</foo2:child> </foo2:element2>
+ </foo2:container>
+</doc>
diff --git a/tests/REC/test-3.4-3.xsl b/tests/REC/test-3.4-3.xsl
new file mode 100644
index 0000000..d5e5029
--- /dev/null
+++ b/tests/REC/test-3.4-3.xsl
@@ -0,0 +1,11 @@
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:foo1="urn:foo1"
+ xmlns:foo2="urn:foo2"
+>
+ <xsl:strip-space elements="*"/>
+ <xsl:template match="doc">
+ <xsl:apply-templates select="*/*"/>
+ </xsl:template>
+</xsl:stylesheet>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]