diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2010-11-08 10:42:33 +0100 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2010-11-08 10:42:33 +0100 |
commit | 2a697a5819f8b22fc7541aae82aacf8b70135a93 (patch) | |
tree | 0e5032d10f43580cdc2816aa2a6ebe0ddc72a77b | |
parent | 072a80a94b76b7397b742a0c2d9602be1b44f0d7 (diff) | |
download | libxslt-2a697a5819f8b22fc7541aae82aacf8b70135a93.tar.gz libxslt-2a697a5819f8b22fc7541aae82aacf8b70135a93.tar.bz2 libxslt-2a697a5819f8b22fc7541aae82aacf8b70135a93.zip |
Fix direct pattern matching bug
and adds a test case for the problem,
also adding a .gitignore cleanup
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | libxslt/pattern.c | 6 | ||||
-rw-r--r-- | tests/docs/bug-170.xml | 3 | ||||
-rw-r--r-- | tests/general/Makefile.am | 1 | ||||
-rw-r--r-- | tests/general/bug-170.out | 4 | ||||
-rw-r--r-- | tests/general/bug-170.xsl | 6 |
6 files changed, 20 insertions, 1 deletions
@@ -143,3 +143,4 @@ tests/XSLTMark/db10000.xml tests/plugins/.libs tests/plugins/plugin.res xsltproc/testThreads +xsltproc/.libs/ diff --git a/libxslt/pattern.c b/libxslt/pattern.c index 8ce74e33..58bd6edb 100644 --- a/libxslt/pattern.c +++ b/libxslt/pattern.c @@ -546,13 +546,15 @@ xsltTestCompMatchDirect(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, xmlNodePtr parent = node->parent; xmlDocPtr olddoc; xmlNodePtr oldnode; - int oldNsNr; + int oldNsNr, oldContextSize, oldProximityPosition; xmlNsPtr *oldNamespaces; oldnode = ctxt->xpathCtxt->node; olddoc = ctxt->xpathCtxt->doc; oldNsNr = ctxt->xpathCtxt->nsNr; oldNamespaces = ctxt->xpathCtxt->namespaces; + oldContextSize = ctxt->xpathCtxt->contextSize; + oldProximityPosition = ctxt->xpathCtxt->proximityPosition; ctxt->xpathCtxt->node = node; ctxt->xpathCtxt->doc = doc; ctxt->xpathCtxt->namespaces = nsList; @@ -562,6 +564,8 @@ xsltTestCompMatchDirect(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, ctxt->xpathCtxt->doc = olddoc; ctxt->xpathCtxt->namespaces = oldNamespaces; ctxt->xpathCtxt->nsNr = oldNsNr; + ctxt->xpathCtxt->contextSize = oldContextSize; + ctxt->xpathCtxt->proximityPosition = oldProximityPosition; if (newlist == NULL) return(-1); if (newlist->type != XPATH_NODESET) { diff --git a/tests/docs/bug-170.xml b/tests/docs/bug-170.xml new file mode 100644 index 00000000..08c3c4dc --- /dev/null +++ b/tests/docs/bug-170.xml @@ -0,0 +1,3 @@ +<root> + <a type="b"/> +</root> diff --git a/tests/general/Makefile.am b/tests/general/Makefile.am index 5d5baf09..e33a6c63 100644 --- a/tests/general/Makefile.am +++ b/tests/general/Makefile.am @@ -177,6 +177,7 @@ EXTRA_DIST = \ bug-167.out bug-167.xsl \ bug-168.out bug-168.xsl \ bug-169.out bug-169.xsl bug-169.imp \ + bug-170.out bug-170.xsl \ character.out character.xsl \ character2.out character2.xsl \ itemschoose.out itemschoose.xsl \ diff --git a/tests/general/bug-170.out b/tests/general/bug-170.out new file mode 100644 index 00000000..e24f8d3a --- /dev/null +++ b/tests/general/bug-170.out @@ -0,0 +1,4 @@ +<?xml version="1.0"?> + + + diff --git a/tests/general/bug-170.xsl b/tests/general/bug-170.xsl new file mode 100644 index 00000000..393bc4b5 --- /dev/null +++ b/tests/general/bug-170.xsl @@ -0,0 +1,6 @@ +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:template match="a[@type='b']" > + <xsl:if test="position()"/> + </xsl:template> + <xsl:template match="a[@type='XX'][.]"/> +</xsl:stylesheet> |