diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2009-09-17 15:23:46 +0200 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2009-09-17 15:23:46 +0200 |
commit | 3d435b25cf2e8112d87cb133c00b94d5924ec75c (patch) | |
tree | 921e0c62276d311b3061d71d5858dcb56d008b50 /tests | |
parent | d65daeaf651adde15a9f34d93d8cf3f3303303ff (diff) | |
download | libxslt-3d435b25cf2e8112d87cb133c00b94d5924ec75c.tar.gz libxslt-3d435b25cf2e8112d87cb133c00b94d5924ec75c.tar.bz2 libxslt-3d435b25cf2e8112d87cb133c00b94d5924ec75c.zip |
Big fixes of pattern compilations
The problem is that "@node()", "attribute::node()", "child::node()" and
"node()" are all handled in different code paths and only the latter
works.
Then, I noticed that the handling of match="child::name" is wrong. It
matches the parents of <name> elements although it should be treated
exactly like match="name". So the whole XSLT_OP_CHILD stuff is
unneeded.
I also found that xsltScanName behaves a bit strange with regard to
':' characters. It doesn't parse an XML Name like the documentation
says. It's better to use xsltScanNCName instead.
Another minor issue is that the parser currently allows invalid
expressions like match="element*" because of lines 1745-1747 in
pattern.c in trunk.
* libxslt/pattern.c: fix all those problems
* tests/REC/Makefile.am tests/REC/test-5.2-19* tests/REC/test-5.2-20*
tests/REC/test-5.2-21*: add test cases to the regression suite
Diffstat (limited to 'tests')
-rw-r--r-- | tests/REC/Makefile.am | 3 | ||||
-rw-r--r-- | tests/REC/test-5.2-19.out | 2 | ||||
-rw-r--r-- | tests/REC/test-5.2-19.xml | 4 | ||||
-rw-r--r-- | tests/REC/test-5.2-19.xsl | 12 | ||||
-rw-r--r-- | tests/REC/test-5.2-20.out | 2 | ||||
-rw-r--r-- | tests/REC/test-5.2-20.xml | 4 | ||||
-rw-r--r-- | tests/REC/test-5.2-20.xsl | 14 | ||||
-rw-r--r-- | tests/REC/test-5.2-21.out | 2 | ||||
-rw-r--r-- | tests/REC/test-5.2-21.xml | 4 | ||||
-rw-r--r-- | tests/REC/test-5.2-21.xsl | 14 |
10 files changed, 61 insertions, 0 deletions
diff --git a/tests/REC/Makefile.am b/tests/REC/Makefile.am index cae04f43..9e228b57 100644 --- a/tests/REC/Makefile.am +++ b/tests/REC/Makefile.am @@ -42,6 +42,9 @@ EXTRA_DIST = \ test-5.2-16.out test-5.2-16.xml test-5.2-16.xsl \ test-5.2-17.out test-5.2-17.xml test-5.2-17.xsl \ test-5.2-18.out test-5.2-18.xml test-5.2-18.xsl \ + test-5.2-19.out test-5.2-19.xml test-5.2-19.xsl \ + test-5.2-20.out test-5.2-20.xml test-5.2-20.xsl \ + test-5.2-21.out test-5.2-21.xml test-5.2-21.xsl \ test-5.3.out test-5.3.xml test-5.3.xsl \ test-5.4-1.out test-5.4-1.xml test-5.4-1.xsl \ test-5.4-2.out test-5.4-2.xml test-5.4-2.xsl \ diff --git a/tests/REC/test-5.2-19.out b/tests/REC/test-5.2-19.out new file mode 100644 index 00000000..eab8e77a --- /dev/null +++ b/tests/REC/test-5.2-19.out @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<result>element</result> diff --git a/tests/REC/test-5.2-19.xml b/tests/REC/test-5.2-19.xml new file mode 100644 index 00000000..56944488 --- /dev/null +++ b/tests/REC/test-5.2-19.xml @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<root> + <element/> +</root> diff --git a/tests/REC/test-5.2-19.xsl b/tests/REC/test-5.2-19.xsl new file mode 100644 index 00000000..d3998e61 --- /dev/null +++ b/tests/REC/test-5.2-19.xsl @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + +<xsl:template match="text()"/> + +<xsl:template match="child::element"> + <result> + <xsl:value-of select="name()"/> + </result> +</xsl:template> + +</xsl:stylesheet> diff --git a/tests/REC/test-5.2-20.out b/tests/REC/test-5.2-20.out new file mode 100644 index 00000000..67a2a014 --- /dev/null +++ b/tests/REC/test-5.2-20.out @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<result>value</result> diff --git a/tests/REC/test-5.2-20.xml b/tests/REC/test-5.2-20.xml new file mode 100644 index 00000000..ca946bc8 --- /dev/null +++ b/tests/REC/test-5.2-20.xml @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<root> + <element attribute="value"/> +</root> diff --git a/tests/REC/test-5.2-20.xsl b/tests/REC/test-5.2-20.xsl new file mode 100644 index 00000000..6590f665 --- /dev/null +++ b/tests/REC/test-5.2-20.xsl @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + +<xsl:template match="*"> + <xsl:apply-templates select="*|@*"/> +</xsl:template> + +<xsl:template match="@node()"> + <result> + <xsl:value-of select="."/> + </result> +</xsl:template> + +</xsl:stylesheet> diff --git a/tests/REC/test-5.2-21.out b/tests/REC/test-5.2-21.out new file mode 100644 index 00000000..67a2a014 --- /dev/null +++ b/tests/REC/test-5.2-21.out @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<result>value</result> diff --git a/tests/REC/test-5.2-21.xml b/tests/REC/test-5.2-21.xml new file mode 100644 index 00000000..ca946bc8 --- /dev/null +++ b/tests/REC/test-5.2-21.xml @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<root> + <element attribute="value"/> +</root> diff --git a/tests/REC/test-5.2-21.xsl b/tests/REC/test-5.2-21.xsl new file mode 100644 index 00000000..15a80fbf --- /dev/null +++ b/tests/REC/test-5.2-21.xsl @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + +<xsl:template match="*"> + <xsl:apply-templates select="*|@*"/> +</xsl:template> + +<xsl:template match="attribute::node()"> + <result> + <xsl:value-of select="."/> + </result> +</xsl:template> + +</xsl:stylesheet> |