From 3513efa939a3811f221ea82ff8d91467c9aea6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 21 Oct 2023 16:58:44 +0200 Subject: Add tests for sxml namespaced + fix 'root-element'. * Removes on-root-element since it was never used * Handle the case of root-elemnt with no *TOP* --- module/sxml/namespaced/util.scm | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'module/sxml/namespaced') diff --git a/module/sxml/namespaced/util.scm b/module/sxml/namespaced/util.scm index 6f93e362..e05f2fa1 100644 --- a/module/sxml/namespaced/util.scm +++ b/module/sxml/namespaced/util.scm @@ -5,7 +5,6 @@ :export (xml-element-hash-key find-element element-matches? - on-root-element root-element )) @@ -30,16 +29,10 @@ (xml-element-hash-key (car tree))))) -(define (on-root-element proc tree) +(define (root-element tree) (cond ((and (eq? '*TOP* (car tree)) (pi-element? (cadr tree))) - (cons* (car tree) (cadr tree) - (proc (caddr tree)))) + (caddr tree)) ((eq? '*TOP* (car tree)) - (cons (car tree) - (proc (cadr tree)))) - (else (proc (car tree))))) - -(define (root-element tree) - (call/ec (lambda (return) - (on-root-element return tree)))) + (cadr tree)) + (else tree))) -- cgit v1.2.3