diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-08-24 19:40:36 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-08-24 19:40:36 +0200 |
commit | 9b56ebd22e3267cedc839e11ee31d69928214ce5 (patch) | |
tree | 2ae82115a4de42cc37c37dc3a9392976928302a4 /module/sxml/namespace.scm | |
parent | Add tests for iCal unknown key warnings. (diff) | |
download | calp-9b56ebd22e3267cedc839e11ee31d69928214ce5.tar.gz calp-9b56ebd22e3267cedc839e11ee31d69928214ce5.tar.xz |
Allow partial change and removal of XML Namespaces.
Changing the error to a returnu allows a partial namespace change map,
which can sometimes be usefull (and should hopefully not lead to any
issues here).
Changing assoc-ref to assoc allows the removal of namespaces, since
assoc-ref can't differentiate between a match with #f in its cdr, and no
match.
(assoc-ref '((a . #f)) 'a) ⇒ #f
(assoc-ref '((a . #f)) 'b) ⇒ #f
Diffstat (limited to 'module/sxml/namespace.scm')
-rw-r--r-- | module/sxml/namespace.scm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/module/sxml/namespace.scm b/module/sxml/namespace.scm index 57250b93..19211227 100644 --- a/module/sxml/namespace.scm +++ b/module/sxml/namespace.scm @@ -34,8 +34,9 @@ (define (nssymb key) (define namespace (if (list? namespace-map) - (or (assoc-ref namespace-map key) - (error "No mapping for namespace" key)) + (cond ((assoc key namespace-map) + => cdr) + (else key)) namespace-map)) (cond |