fixed small problem with key initialisation disturbing the transformation
authorWilliam M. Brack <wbrack@src.gnome.org>
Sat, 28 Aug 2004 04:00:26 +0000 (04:00 +0000)
committerWilliam M. Brack <wbrack@src.gnome.org>
Sat, 28 Aug 2004 04:00:26 +0000 (04:00 +0000)
* libxslt/keys.c: fixed small problem with key initialisation
  disturbing the transformation context (bug 151201).
* tests/general/bug-153.*, tests/general/Makefile.am,
  tests/docs/bug-153*, tests/docs/Makefile.am: added test case
  for above

ChangeLog
libxslt/keys.c
libxslt/xsltwin32config.h
tests/docs/Makefile.am
tests/docs/bug-153.doc [new file with mode: 0644]
tests/docs/bug-153.xml [new file with mode: 0644]
tests/general/Makefile.am
tests/general/bug-153.out [new file with mode: 0644]
tests/general/bug-153.xsl [new file with mode: 0644]

index d57a96b..3af218a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Aug 27 20:52:52 PDT 2004 William Brack <wbrack@mmm.com.hk>
+
+       * libxslt/keys.c: fixed small problem with key initialisation
+         disturbing the transformation context (bug 151201).
+       * tests/general/bug-153.*, tests/general/Makefile.am,
+         tests/docs/bug-153*, tests/docs/Makefile.am: added test case
+         for above
+
 Tue Aug 24 16:40:51 CEST 2004 Igor Zlatkovic <igor@zlatkovic.com>
 
        * win32/configure.js: added support for version extra
index f5965b6..259c21b 100644 (file)
@@ -531,6 +531,7 @@ xsltInitCtxtKey(xsltTransformContextPtr ctxt, xsltDocumentPtr doc,
     xsltKeyTablePtr table;
     int        oldPos, oldSize;
     xmlNodePtr oldInst;
+    xmlNodePtr oldNode;
     xsltDocumentPtr oldDoc;
     xmlDocPtr oldXDoc;
     int oldNsNr;
@@ -543,10 +544,11 @@ xsltInitCtxtKey(xsltTransformContextPtr ctxt, xsltDocumentPtr doc,
     oldXDoc= ctxt->xpathCtxt->doc;
     oldPos = ctxt->xpathCtxt->proximityPosition;
     oldSize = ctxt->xpathCtxt->contextSize;
-    oldInst = ctxt->inst;
-    oldDoc = ctxt->document;
     oldNsNr = ctxt->xpathCtxt->nsNr;
     oldNamespaces = ctxt->xpathCtxt->namespaces;
+    oldInst = ctxt->inst;
+    oldDoc = ctxt->document;
+    oldNode = ctxt->node;
 
     if (keyd->comp == NULL)
        goto error;
@@ -687,6 +689,7 @@ error:
     ctxt->xpathCtxt->doc = oldXDoc;
     ctxt->xpathCtxt->nsNr = oldNsNr;
     ctxt->xpathCtxt->namespaces = oldNamespaces;
+    ctxt->node = oldNode;
     if (res != NULL)
        xmlXPathFreeObject(res);
 }
index 55e77b5..1536eaa 100644 (file)
@@ -44,7 +44,7 @@ extern "C" {
  *
  * extra version information, used to show a CVS compilation
  */
-#define LIBXML_VERSION_EXTRA "-CVS936"
+#define LIBXML_VERSION_EXTRA "-CVS938"
 
 /**
  * WITH_XSLT_DEBUG:
index ec4f815..a86d91f 100644 (file)
@@ -151,6 +151,8 @@ EXTRA_DIST =        \
        bug-149.xml \
        bug-150.xml \
        bug-151.xml \
+       bug-152.xml \
+       bug-153.xml bug-153.doc \
        character.xml \
        array.xml \
        items.xml
diff --git a/tests/docs/bug-153.doc b/tests/docs/bug-153.doc
new file mode 100644 (file)
index 0000000..ea2a7a0
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<ch>
+  <v name="dd">XXXXXXXXXXX</v>
+</ch>
diff --git a/tests/docs/bug-153.xml b/tests/docs/bug-153.xml
new file mode 100644 (file)
index 0000000..35e5852
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<cp>
+  <c>
+    <v>dd</v>
+  </c>
+  <c>
+    <v>dd</v>
+  </c>
+</cp>
index 5200c8b..74e4851 100644 (file)
@@ -160,6 +160,7 @@ EXTRA_DIST = \
     bug-150.out bug-150.xsl \
     bug-151.out bug-151.xsl \
     bug-152.out bug-152.xsl \
+    bug-153.out bug-153.xsl \
     character.out character.xsl \
     character2.out character2.xsl \
     itemschoose.out itemschoose.xsl \
diff --git a/tests/general/bug-153.out b/tests/general/bug-153.out
new file mode 100644 (file)
index 0000000..1f9a790
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<p>XXXXXXXXXXX</p><p>XXXXXXXXXXX</p>
diff --git a/tests/general/bug-153.xsl b/tests/general/bug-153.xsl
new file mode 100644 (file)
index 0000000..68b0532
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+
+<xsl:transform
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <xsl:template match="cp">
+    <xsl:apply-templates select="c"/>
+  </xsl:template>
+
+  <xsl:template match="c">
+    <p>
+      <xsl:value-of select="document('../docs/bug-153.doc')/ch/v[@name=current()/v]"/>
+    </p>
+  </xsl:template>
+
+  <xsl:key name="k" match="u/p" use="un"/>
+
+</xsl:transform>