Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > d41e7febba7533a5711c18660c676cc9 > files > 15

libxslt-1.1.17-4.el5_8.3.src.rpm

From 7f2776d23c2bac0c226592ee927d52f8b5d48a2d Mon Sep 17 00:00:00 2001
From: "William M. Brack" <wbrack@src.gnome.org>
Date: Wed, 14 Feb 2007 09:19:14 +0000
Subject: [PATCH] Fixed problem with namespace on compound predicate (bug
 #407731)
To: libvir-list@redhat.com

* libxslt/pattern.c: Fixed problem with namespace on compound predicate (bug #407731)

svn path=/trunk/; revision=1420

Conflicts:
	ChangeLog

Signed-off-by: Daniel Veillard <veillard@redhat.com>
---
 ChangeLog         | 415 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 libxslt/pattern.c |  15 +-
 2 files changed, 428 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 399871d..4b779cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,418 @@
+Wed Feb 14 01:21:38 PST 2007 William Brack <wbrack@mmm.com.hk>
+
+	* libxslt/pattern.c: Fixed problem with namespace on compound
+	  predicate (bug #407731)
+
+Wed Jan 24 11:05:28 PST 2007 William Brack <wbrack@mmm.com.hk>
+
+	* libxslt/pattern.c: added check for memory allocation error
+	  (bug #400242); fixed "type-punned pointer" warnings.
+	* libxslt/xsltutils.c: added checks for memory allocation error
+	  (bug #400242)
+	* restored NEWS, doc/EXSLT/downloads.html which mysteriously
+	  disappeared from svn
+	
+Wed Jan 17 14:20:18 CET 2007 Daniel Veillard <daniel@veillard.com>
+
+	* configure.in doc/*: preparing release of 1.1.20
+	* libexslt/crypto.c: small patch for missing includes on some BSD,
+	  fixes #397373
+	* configure.in: replace == by = in test, raised by Roland Illig,
+	  should fix #397371
+
+Sun Jan 14 18:45:08 PST 2007 William Brack <wbrack@mmm.com.hk>
+
+	* libxslt/functions.c: fixed two problems related to checking
+	  of fragments, related to python htmlCtxtReadFile problem
+	  reported on mailing list by Nic Ferrier.
+
+Fri Jan 12 23:24:08 PST 2007 William Brack <wbrack@mmm.com.hk>
+
+	* libxslt/extensions.c: reverted last change, fixed some
+	  comments.  Note that in it's current state the 'plugin'
+	  implementation will fail if called from a program
+	  compiled as static!
+
+Fri Jan 12 15:40:08 PST 2007 William Brack <wbrack@mmm.com.hk>
+
+	* configure.in: fixed problem with DV/WMB testing env.
+	* regenerated docs; doc/APIchunk1[012].html added to SVN
+	* libxslt/extensions.c: fixed problem with plugin loading;
+	  removed testplugin.c from SVN (current version kept as
+	  tests/plugin/testplugin.c)
+
+Thu Jan 11 11:08:18 PST 2007 William Brack <wbrack@mmm.com.hk>
+
+	* libxslt/transform.c: enhanced to ignore empty text node
+	  in xsltDefaultProcessOneNode (avoid calling xsltCopyText)
+	  (bug #354900)
+	* xsltproc/xsltproc.c: added check for output file problem,
+	  yielding new error code 11 (Mike Hommey).
+	* doc/xsltproc.html, doc/xsltproc.xml: added documentation
+	  for above, regenerated docs (doc/xsltproc.1)
+
+Wed Jan 10 19:13:08 PST 2007 William Brack <wbrack@mmm.com.hk>
+
+	* libexslt/strings.c: added new function 'replace' from Joel
+	  Reed.
+	* tests/exslt/Makefile.am, replace.1.xml, replace.1.xsl,
+	  replace.1.out: added new test case for above.
+	* libxslt.spec.in: trivial change from 'Gnome' to 'GNOME'
+	* configure.in: trivial change for flags on my compilations
+	* libxslt/documents.c, libxslt/documents.h, libxslt/keys.c,
+	  libxslt/keys.h, libxslt/variables.c, libxslt/templates.c,
+	  libxslt/transform.c, libxslt/variables.c, libxslt/xslt.c,
+	  libxslt/xsltutils.c: fixed some documentation/comments and
+	  compilation warnings - no change to logic.
+	* re-generated the documentation.
+
+Wed Jan  3 16:46:05 CET 2007 Daniel Veillard <daniel@veillard.com>
+
+	* configure.in: adapt the extra versioning code to SVN
+
+Fri Dec 22 09:12:08 PST 2006 William Brack <wbrack@mmm.com.hk>
+
+	* python/libxslt.c: applied patch supplied by Kjartan Maraas
+	  (bug #388567).
+
+Mon Dec 11 14:38:22 PST 2006 William Brack <wbrack@mmm.com.hk>
+
+	* libexslt/functions.c: further enhancement to the original
+	  fix for bug #381319 (which was not correct).
+	* tests/exslt/functions: minor enhancement to function.9.xsl;
+	  function.10.[xsl,xml,out] added to regression tests to check
+	  recursive calls.
+
+Mon Dec 11 12:13:14 CET 2006 Daniel Veillard <daniel@veillard.com>
+
+	* configure python/generator.py python/libxsl.py
+	  python/libxslt-python-api.xml python/libxslt.c
+	  python/tests/2stage.py python/tests/loader.py: applied patch from
+	  Nic James Ferrier to make stylesheets comparable and to add
+	  transformContext handling
+
+Sat Dec  9 15:22:34 PST 2006 William Brack <wbrack@mmm.com.hk>
+
+	* libexslt/functions.c: changed handling of function params
+	  to fix bug #381319
+	* libxslt/transform.[ch]: exposed xsltLocalVariablePush and
+	  xsltLocalVariablePop as global entries so that they could
+	  be used from within libexslt/functions.c
+	* tests/exslt/functions/function.9.[xsl,xml,out] added to
+	  regression tests
+
+Tue Dec  5 10:45:04 CET 2006 Daniel Veillard <daniel@veillard.com>
+
+	* libxslt/extensions.c: applied patch from Marcus Meissner removing
+	  a strict aliasing problem should fix #317921
+
+Fri Dec  1 23:02:27 HKT 2006 William Brack <wbrack@mmm.com.hk>
+
+	* libxslt/transform.c: fixed problem with housekeeping of
+	  localRVTBase, bug #378766
+
+Wed Nov 29 16:06:43 CET 2006 Daniel Veillard <daniel@veillard.com>
+
+	* NEWS configure.in doc//*: preparing release of libxslt-1.1.19
+
+Sat Nov 25 11:48:28 HKT 2006 William Brack <wbrack@mmm.com.hk>
+
+	* libxslt/variables.c: fixed problem with cached RVT's,
+	  bug #378766
+
+Thu Nov 23 17:49:31 CET 2006 Daniel Veillard <daniel@veillard.com>
+
+	* libxslt/transform.c: applied patch from Mike Hommey about saving
+	  the current in-scope namespace list when calling a template, fixes
+	  bug #377579
+
+Thu Nov 23 15:36:28 CET 2006 Daniel Veillard <daniel@veillard.com>
+
+	* configure.in: fix a python detection problem pointed out by 
+	  Joseph Sacco, fixes bug #376391
+
+Fri Nov 17 09:53:08 HKT 2006 William Brack <wbrack@mmm.com.hk>
+
+	* libxslt/transform.c: fixed problem with entity handling
+	  within xsltCopyAttrListNoOverwrite (#352907)
+	* tests/general/bug-164.xsl, tests/general/bug-164.out,
+	  tests/docs/bug-164.oxml: added a regression test for this
+
+Thu Oct 26 15:31:01 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+	* NEWS configure.in doc//*: preparing release of libxslt-1.1.18,
+	  this bumps libxml2 requirement to 1.6.27
+	* libexslt/date.c libxslt/namespaces.h libxslt/xslt.c 
+	  libxslt/xsltInternals.h: cosmetic cleanups to restore the
+	  API extraction
+
+Thu Oct 26 10:36:43 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+	* doc//*: removed all remaining references to the old Wiki
+
+Thu Oct 12 23:12:24 HKT 2006 William Brack <wbrack@mmm.com.hk>
+
+	* libexslt/date.c: fixed end-of-month problem in exsltDateCurrent
+	  (#359246)
+
+Thu Oct 12 14:39:37 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+	* libxslt/preproc.c: applied patch from Mike Hommey fixing 2 
+	  erroneous xmlFree() and adding a message on an unsupported feature
+
+Wed Oct 11 23:16:10 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+	* python/libxslt-python-api.xml: applied fix for accessor functions
+	  of a stylesheet returning pointers to immutable strings, patch
+	  from #320540
+	* xsltproc/xsltproc.c: fix the xinclude on stylehseet problem
+	  by adding a new parameter to xsltproc names --xincludestyle
+
+Wed Oct 11 22:27:37 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+	* xsltproc/xsltproc.c: apply patch from Gary Coady to compile when
+	  libxml2 has no xinclude support #319886
+	* docs/*: renamed Gnome to GNOME fixes #352159
+
+Wed Oct 11 21:37:27 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+	* libxslt/Makefile.am: a missing DESTDIR
+	* python/Makefile.am: fix reference to build paths in python module
+	* libexslt/exsltconfig.h.in libxslt/xsltconfig.h.in: fix the header
+	  comments on version values, the 3 are patches from Peter
+	  Breitenlohner   and should fix #340995
+
+Wed Oct 11 11:16:34 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+	* libxslt/security.c: applied cleanup patch from Mikhail Zabaluev
+	  which should finish fixing #337486
+
+Wed Oct 11 09:55:06 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+	* libxslt/security.c: applied fix from Shane Corgatelli to pass
+	  the full URL when checking security access for network URLs,
+	  should fix bug #359366
+
+Mon Aug 21 10:46:25 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+	* doc/xslt.html python/tests/pyxsltproc.py xsltproc/xsltproc.c: 
+	  applied patch from Daniel Leidert to fix some typo
+	* xsltproc.xml xsltproc.1: applied another patch from Daniel Leidert
+	  and regenerated
+
+Wed Aug 16 17:39:04 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+	* xsltproc/xsltproc.c: --xinclude should also force XInclude
+	  processing on the stylesheets themselves, raised by Daniel Leidert
+
+Thu Aug 10 15:54:02 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
+
+	* libxslt/transform.c libxslt/variables.c
+	  libxslt/xsltInternals.h: Fixed restoring the context doc
+	  for XPath in xsltForEach(). Eliminated the use of @tmpDoc
+	  of the transformation context.
+
+Thu Aug 10 13:40:35 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
+
+	* libxslt/preproc.c: Added missing QName-validation of some
+	  attributes of XSLT-elements. This fixes bug #304921, reported
+	  by Frans Englich.
+
+Thu Aug 10 13:27:48 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
+
+	* libxslt/transform.c: As suggested by Bill, I changed
+	  xsltShallowCopyNsNode() to return an xmlNsPtr instead of
+	  an int. The fix of bug #350085 is OK; i.e. the removal
+	  of the call to xsltFreeRVTs() in
+	  xsltApplyStylesheetInternal(). I think I tried to clear
+	  the transformation context as much as possible, in case
+	  it is reused; Daniel informed me on the list that reusing
+	  the context is not intended, so no need anymore to try
+	  to free the fragments immediately after the transformation.
+
+Wed Aug  9 13:22:13 PDT 2006 William Brack <wbrack@mmm.com.hk>
+
+	* libxslt/transform.c: Fixed problem with cleanup of RVT's, should
+	  clear bug350085; cleaned up most warnings (still a problem in
+	  xsltShallowCopyNsNode)
+	* trivial warning cleanup in libxslt/[extensions.c, namespaces.c,
+	  xslt.c and xsltInternals.h] and libexslt/functions.c
+
+Fri Aug  4 14:50:41 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+	* python/generator.py: fixed the conversion of long parameters
+
+Wed Jul 19 15:06:39 EDT 2006 Daniel Veillard <daniel@veillard.com>
+
+	* python/types.c: fix float and boolean XPath conversions
+	* libxslt/xsltutils.c: try to fix Stephane Bidoul attempt
+	  at setting XInclude support.
+
+Mon Jul 17 11:15:23 PDT 2006 William Brack <wbrack@mmm.com.hk>
+
+	* Updated tests affected by recent library changes -
+	  tests/general/bug-1-.out, tests/general/bug-24-.out,
+	  tests/keys/month.out : (<t></t> now becomes <t/>);
+	  tests/general/bug-41-.xsl and tests/general/bug-43.xsl :
+	  call-template and apply-template, where the template has
+	  no parameter but one is supplied (var should not be affected)
+	  tests/general/bug-145.err : changed error text
+	  
+Fri Jul 14 18:16:59 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
+
+	* libxslt/attributes.c libxslt/documents.c
+	  libxslt/functions.c libxslt/keys.c libxslt/namespaces.c
+	  libxslt/pattern.c libxslt/preproc.c libxslt/templates.c
+	  libxslt/templates.h libxslt/transform.c
+	  libxslt/variables.c libxslt/xslt.c
+	  libxslt/xsltInternals.h libxslt/xsltutils.c
+	  libxslt/xsltutils.h libexslt/common.c libexslt/dynamic.c
+	  libexslt/functions.c libexslt/strings.c:
+	  Committing again, since I forgot to switch from win to linux
+	  linebreaks in the files.
+						    
+Fri Jul 14 17:55:42 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
+
+	* libxslt/attributes.c libxslt/documents.c
+	  libxslt/functions.c libxslt/keys.c libxslt/namespaces.c
+	  libxslt/pattern.c libxslt/preproc.c libxslt/templates.c
+	  libxslt/templates.h libxslt/transform.c libxslt/variables.c
+	  libxslt/xslt.c libxslt/xsltInternals.h libxslt/xsltutils.c
+	  libxslt/xsltutils.h libexslt/common.c libexslt/dynamic.c
+	  libexslt/functions.c libexslt/strings.c:
+	  Refactored xsltValueOf(). Changed to use xmlXPathCastToString()
+	  directly, rather than creating an intermediate object with
+	  xmlXPathConvertString(). This now does not add a text-node to
+	  the result if the string is empty (this has impact on
+	  serialization, since an empty text-node is serialized as
+	  <foo></foo>, and now it will be serialized as <foo/>).
+	  Refactored other functions in transform.c:
+	  Mostly code cleanup/restructuring. Minimized number of
+	  function variables for instruction which eat up function stack
+	  memory when recursing templates (xsltIf(), xsltChoose(),
+	  xsltApplyTemplates(),  xsltCallTemplate()).
+	  Changed XSLT tests to use xmlXPathCompiledEvalToBoolean().
+	  Implemented redefinition checks at compilation-time and
+	  eliminating them at transformation time in the refactored code
+	  paths.
+	  Introduced the field @currentTemplateRule on xsltTransformContext to
+	  reflect the "Current Template Rule" as defined by the spec.
+	  NOTE that ctxt->currentTemplateRule and ctxt->templ is not the
+	  same; the former is the "Current Template Rule" as defined by the
+	  XSLT spec, the latter is simply the template struct being
+	  currently processed by Libxslt.
+	  Added XML_COMMENT_NODE and XML_CDATA_SECTION_NODE to the macro
+	  IS_XSLT_REAL_NODE.
+	  Misc code cleanup/restructuring and everything else I already forgot.
+	  Refactored lifetime of temporary result tree fragments.
+	  Substituted all calls to the now deprecated xsltRegisterTmpRVT()
+	  for the new xsltRegisterLocalRVT().
+	  Fragments of xsl:variable and xsl:param are freed when the
+	  variable/pram is freed.
+	  Fragments created when evaluating a "select" of xsl:varible and
+	  xsl:param are also bound to the lifetime of the var/param.
+	  EXSLT's func:function now uses the following functions to let take
+	  care the transformation's garbage collector of returned tree
+	  fragments:
+	    xsltExtensionInstructionResultRegister(),
+	    xsltExtensionInstructionResultFinalize()
+	  Fixes:
+	  #339222 - xsl:param at invalid position inside an xsl:template is
+	            not catched
+	  #346015 - Non-declared caller-parameters are accepted
+	  #160400 - Compiles invalid XSLT; unbound variable accepted
+	  #308441 - namespaced parameters become unregistered
+	  #307103 - problem with proximity position in predicates of match
+	            patterns
+	  #328218 - problem with exsl:node-set() when converting strings
+	            to node sets
+	  #318088 - infinite recursion detection
+	  #321505 - Multiple contiguous CDATA in output
+	  #334493 - "--param" option does not have root context
+	  #114377 - weird func:result/xsl:variable/exsl:node-set interaction
+	  #150309 - Regression caused by fix for 142768
+
+Wed Jun 21 15:13:27 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
+
+	* tests/docs/bug-54.xml tests/general/bug-54.out
+	  tests/general/bug-99.out tests/general/bug-136.out
+	  tests/REC/test-7.1.3.xsl tests/REC/test-7.1.4.xsl
+	  tests/REC/test-7.3.xsl tests/REC/test-7.4.xsl:
+	  Fixed incorrect regression tests/results.
+
+Mon Jun 19 13:33:50 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
+
+	* libxslt/attributes.c libxslt/attrvt.c libxslt/namespaces.c
+	  libxslt/namespaces.h libxslt/preproc.c libxslt/templates.c
+	  libxslt/transform.c libxslt/variables.c libxslt/xslt.c
+	  libxslt/xsltInternals.h libxslt/xsltutils.c:
+	  Merged all the namespace lookup/create/disable functions
+	  into xsltGetSpecialNamespace(). Changed xsltGetNamespace()
+	  and xsltGetPlainNamespace() to call xsltGetSpecialNamespace(),
+	  but kept the ns-aliasing mechanism; the ns-aliasing needs
+	  to be removed when we move to the refactored code, which
+	  applies ns-alias only at compilaton time.
+	  Refactored xsltElementComp() (preproc.c); enhanced error reports.
+	  Fixed: if the "namespace" attribute was not given, then this
+	  performed incorrectly only a lookup for a default namespace;
+	  i.e., without taking any prefix on the "name" attribute into
+	  account.
+	  Refactored xsltElement() (transform.c); enhanced error reports.
+	  Refactored xsltAttributeComp() (preproc.c). Added namespace
+	  lookup as in xsltElementComp(). Enhanced error reports.
+	  Refactored xsltAttribute() (transform.c); enhanced error reports.
+	  xsltCopyTreeInternal(): eliminated the need to call xmlGetNsList()
+	  for every element in the tree; this needs to be done only for
+	  the top-most elements. For subsequent elements reconcile only
+	  the ns-declarations. Disallowed setting of ns-declarations if
+	  children have been already added to an element.
+	  Removed ns-aliasing code where necessary.
+	  xsltCopyProp(): disallowed setting of attribute nodes if
+	  children have been already added to an element.
+	  xsltCopy(): removed the incorrect skipping of attributes in the
+	  XSLT namespace. Removed the incorrect ns-aliasing for attributes.
+	  Changed to use the introduced function xsltShallowCopyAttr().
+	  xsltShallowCopyAttr():  Centralized all attribute-copy related
+	  code in this function. It will now be called by
+	  xsltCopyTreeInternal(), xsltCopyOf() and xsltCopy().
+	  xsltCopyAttrListNoOverwrite(): Renamed. Refactored. Optimized to
+	  use xsltGetSpecialNamespace() and xmlNewDocProp().
+	  Further substitution of various scattered namespace-lookup
+	  related code for the use of xsltGetSpecialNamespace().
+	  xsltAttrTemplateProcess(): Refactored. Removed the incorrect
+	  processing of attribute-sets. Attribute sets need to be applied
+	  before adding any normal attribute of the literal result element;
+	  this is now done in  xsltAttrListTemplateProcess(). Fixed to
+	  ensure that the ns-prefix of the overwriting attribute is used.
+	  xsltAttrListTemplateProcess(): Refactored. Moved semantics from
+	  xsltAttrTemplateProcess() over to this function in order to
+	  optimize processing of multiple attributes. This does not call
+	  xsltAttrTemplateProcess() anymore.
+	  Fixed: do not exclude the XSLT namespace after ns-aliasing have
+	  beed applied.
+	  The IFDEFed-out refactored code fixes the following issues:
+	  - #313711: namespace collision with namespace-alias (reported
+	              by by Oleg Paraschenko)
+	  - #338214: Incorrect scope for exclude-result-prefixes
+	  - #341392: Excluding namespace declarations of literal result
+	             elements.
+	  - #341325: Namespace aliasing and resulting namespace prefixes
+	  Already enabled fixes:
+	  - #344183: xsl:copy misses to copy attributes in the XSLT namespace
+	  - #341463: Namespace-alias using #default for result-prefix with no
+	  	     default namespace in scope
+	  - #313890: namespace collision with xsl:element and xsl:attribute,
+	  	     reported by Oleg Paraschenko
+	  - #344176: xsl:copy misses to set an element's namespace-URI in
+	             some cases
+	  - #305739: the "name" QName of xsl:element is incorrectly always
+	  	     resolved to the default namespace
+
+Mon Jun 12 16:34:15 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+	* doc/xsltproc.1 doc/xsltproc.xml: more info about --output
+	  from Daniel Leidert c.f. #344654
+
 Tue Jun  6 17:16:33 CEST 2006 Daniel Veillard <daniel@veillard.com>
 
 	* configure.in libxslt.spec.in doc//*: preparing release of 1.1.17
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
index 8c28d4f..b7c2391 100644
--- a/libxslt/pattern.c
+++ b/libxslt/pattern.c
@@ -448,6 +448,8 @@ xsltPatPushState(xsltStepStates *states, int step, xmlNodePtr node) {
  * @ctxt:  a XSLT process context
  * @comp: the precompiled pattern
  * @node: a node
+ * @nsList: the namespaces in scope
+ * @nsNr: the number of namespaces in scope
  *
  * Test whether the node matches the pattern, do a direct evalutation
  * and not a step by step evaluation.
@@ -456,7 +458,7 @@ xsltPatPushState(xsltStepStates *states, int step, xmlNodePtr node) {
  */
 static int
 xsltTestCompMatchDirect(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
-	                xmlNodePtr node) {
+	                xmlNodePtr node, xmlNsPtr *nsList, int nsNr) {
     xsltStepOpPtr sel = NULL;
     xmlDocPtr prevdoc;
     xmlDocPtr doc;
@@ -483,14 +485,22 @@ xsltTestCompMatchDirect(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
 	xmlNodePtr parent = node->parent;
 	xmlDocPtr olddoc;
 	xmlNodePtr oldnode;
+	int oldNsNr;
+	xmlNsPtr *oldNamespaces;
 
 	oldnode = ctxt->xpathCtxt->node;
 	olddoc = ctxt->xpathCtxt->doc;
+	oldNsNr = ctxt->xpathCtxt->nsNr;
+	oldNamespaces = ctxt->xpathCtxt->namespaces;
 	ctxt->xpathCtxt->node = node;
 	ctxt->xpathCtxt->doc = doc;
+	ctxt->xpathCtxt->namespaces = nsList;
+	ctxt->xpathCtxt->nsNr = nsNr;
 	newlist = xmlXPathEval(comp->pattern, ctxt->xpathCtxt);
 	ctxt->xpathCtxt->node = oldnode;
 	ctxt->xpathCtxt->doc = olddoc;
+	ctxt->xpathCtxt->namespaces = oldNamespaces;
+	ctxt->xpathCtxt->nsNr = oldNsNr;
 	if (newlist == NULL)
 	    return(-1);
 	if (newlist->type != XPATH_NODESET) {
@@ -817,7 +827,8 @@ restart:
 			/* Free the rollback states */
 			xmlFree(states.states);
 		    }
-		    return(xsltTestCompMatchDirect(ctxt, comp, node));
+		    return(xsltTestCompMatchDirect(ctxt, comp, node,
+		    				   comp->nsList, comp->nsNr));
 		}
 
 		doc = node->doc;
-- 
1.7.11.4