From f87ab4b859f50890d38de63a7925a31beec0f3ae Mon Sep 17 00:00:00 2001 From: David Lichteblau Date: Sun, 16 Mar 2008 17:46:16 +0100 Subject: [PATCH] Fixed namespace axis --- xpath.lisp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/xpath.lisp b/xpath.lisp index 2b40e5e..17dbb72 100644 --- a/xpath.lisp +++ b/xpath.lisp @@ -126,17 +126,23 @@ (recurse () (etypecase node (null) - (element + (stp:element + (let ((parent (stp:parent node))) (map-extra-namespaces #'yield node) - (when (plusp (length (%namespace-prefix node))) - (yield (%namespace-prefix node) - (%namespace-uri node))) - (dolist (a (%attributes node)) - (when (plusp (length (namespace-prefix a))) - (yield (namespace-prefix a) (namespace-uri a)))) - (setf node (stp:parent node)) + (unless (and (zerop (length (%namespace-prefix node))) + (zerop (length (%namespace-uri node))) + (or (typep parent 'stp:document) + (zerop + (length + (stp:find-namespace "" parent))))) + (yield (%namespace-prefix node) + (%namespace-uri node))) + (dolist (a (%attributes node)) + (when (plusp (length (namespace-prefix a))) + (yield (namespace-prefix a) (namespace-uri a)))) + (setf node parent)) (iterate)) - (document + (stp:document (yield "xml" "http://www.w3.org/XML/1998/namespace") #+nil (yield "xmlns" "http://www.w3.org/2000/xmlns/") (setf node nil) -- 2.11.4.GIT