From 36c5b594f3535610e89891eed52b721d1f9912cc Mon Sep 17 00:00:00 2001 From: David Lichteblau Date: Sun, 13 Apr 2008 22:28:11 +0200 Subject: [PATCH] #default can be aliased --- TEST | 10 +++++----- test.lisp | 11 ++++++++--- unparse.lisp | 7 ++++++- xslt.lisp | 4 +++- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/TEST b/TEST index b80aae6..d338476 100644 --- a/TEST +++ b/TEST @@ -11325,7 +11325,7 @@ WARNING: Context: Line 2, column 153 in NIL -FAIL BVTs_bvt058 [Mixed]: output doesn't match +PASS BVTs_bvt058 [Mixed] Stylesheet: MSFT_Conformance_Tests/BVTs/nsalias.noindent-xsl Data: MSFT_Conformance_Tests/BVTs/data.xml Expected output (1): MSFT_Conformance_Tests/BVTs/BVTs_bvt058.saxon @@ -15222,7 +15222,7 @@ FAIL Namespace-alias__91801 [XSLT-Structure]: output doesn't match Expected output (1): MSFT_Conformance_Tests/Namespace-alias/Namespace-alias__91801.saxon Actual output: MSFT_Conformance_Tests/Namespace-alias/Namespace-alias__91801.xuriella -FAIL Namespace-alias_Namespace-Alias_NSAliasForDefaultWithExcludeResPref [XSLT-Structure]: output doesn't match +PASS Namespace-alias_Namespace-Alias_NSAliasForDefaultWithExcludeResPref [XSLT-Structure] Stylesheet: MSFT_Conformance_Tests/Namespace-alias/NSaliasWithDefaultResultPrefix.noindent-xsl Data: MSFT_Conformance_Tests/Namespace-alias/NSaliasWithDefaultResultPrefix.xml Expected output (1): MSFT_Conformance_Tests/Namespace-alias/Namespace-alias_Namespace-Alias_NSAliasForDefaultWithExcludeResPref.saxon @@ -15234,13 +15234,13 @@ PASS Namespace-alias_Namespace-Alias_RenameAliasIfClauseForResultDocument [XSLT- Expected output (1): MSFT_Conformance_Tests/Namespace-alias/Namespace-alias_Namespace-Alias_RenameAliasIfClauseForResultDocument.saxon Actual output: MSFT_Conformance_Tests/Namespace-alias/Namespace-alias_Namespace-Alias_RenameAliasIfClauseForResultDocument.xuriella -FAIL Namespace-alias_Namespace-Alias_Test1 [XSLT-Structure]: output doesn't match +PASS Namespace-alias_Namespace-Alias_Test1 [XSLT-Structure] Stylesheet: MSFT_Conformance_Tests/Namespace-alias/xslt_nsalias_test1.noindent-xsl Data: MSFT_Conformance_Tests/Namespace-alias/foo.xml Expected output (1): MSFT_Conformance_Tests/Namespace-alias/Namespace-alias_Namespace-Alias_Test1.saxon Actual output: MSFT_Conformance_Tests/Namespace-alias/Namespace-alias_Namespace-Alias_Test1.xuriella -FAIL Namespace-alias_Namespace-Alias_Test2 [XSLT-Structure]: output doesn't match +PASS Namespace-alias_Namespace-Alias_Test2 [XSLT-Structure] Stylesheet: MSFT_Conformance_Tests/Namespace-alias/xslt_nsalias_test2.noindent-xsl Data: MSFT_Conformance_Tests/Namespace-alias/foo.xml Expected output (1): MSFT_Conformance_Tests/Namespace-alias/Namespace-alias_Namespace-Alias_Test2.saxon @@ -19454,4 +19454,4 @@ PASS XSLTFunctions_DocumentFuncWithEmptyArg [Mixed] Expected output (1): MSFT_Conformance_Tests/XSLTFunctions/XSLTFunctions_DocumentFuncWithEmptyArg.saxon Actual output: MSFT_Conformance_Tests/XSLTFunctions/XSLTFunctions_DocumentFuncWithEmptyArg.xuriella -Passed 2837/3081 tests (3 expected failures, 241 unexpected failures). +Passed 2841/3081 tests (3 expected failures, 237 unexpected failures). diff --git a/test.lisp b/test.lisp index 201c3f4..5781db5 100644 --- a/test.lisp +++ b/test.lisp @@ -344,8 +344,12 @@ ;; Tests where the output isn't a match because of extraneous whitespace. ;; For these tests, we force space normalization before comparing. ;; -;; (SANITIZE-STYLESHEET is supposed to get rid of indent="yes", but it -;; misses imported stylesheets.) +;; Possible reasons for this problem are: +;; a. The output method is declared in an imported stylesheet. +;; SANITIZE-STYLESHEET is supposed to get rid of indent="yes", but it +;; misses imported stylesheets. +;; b. Saxon output isn't a match, but the official output is. +;; But the official output is unaffected by SANITIZE-STYLESHEET. ;; (defparameter *whitespace-issues* '("BVTs_bvt044" @@ -353,7 +357,8 @@ "AttributeSets__91038" "BVTs_bvt041" "BVTs_bvt042" - "BVTs_bvt054")) + "BVTs_bvt054" + "BVTs_bvt058")) (defparameter *known-failures* '( diff --git a/unparse.lisp b/unparse.lisp index 7014a29..67e8269 100644 --- a/unparse.lisp +++ b/unparse.lisp @@ -191,6 +191,11 @@ ("xmlns" . #"http://www.w3.org/2000/xmlns/") ("xml" . #"http://www.w3.org/XML/1998/namespace"))) +(defun unalias-attribute-uri (uri) + (if (zerop (length uri)) + uri + (unalias-uri uri))) + (defun invoke-with-element (fn local-name uri &key suggested-prefix extra-namespaces process-aliases) (check-type local-name string) @@ -271,7 +276,7 @@ (check-type value string) (check-type suggested-prefix (or null string)) (when process-aliases - (setf uri (unalias-uri uri))) + (setf uri (unalias-attribute-uri uri))) (cond ((null *current-element*) (xslt-cerror "attribute outside of element")) diff --git a/xslt.lisp b/xslt.lisp index 776b7bb..b2fea82 100644 --- a/xslt.lisp +++ b/xslt.lisp @@ -673,7 +673,9 @@ (do-toplevel (elt "namespace-alias" ) (stp:with-attributes (stylesheet-prefix result-prefix) elt (setf (gethash - (xpath-sys:environment-find-namespace env stylesheet-prefix) + (if (equal stylesheet-prefix "#default") + "" + (xpath-sys:environment-find-namespace env stylesheet-prefix)) (stylesheet-namespace-aliases stylesheet)) (xpath-sys:environment-find-namespace env -- 2.11.4.GIT