(define xml '(*TOP* (*PI* (xml "version=\"1.0\"") (foo (@ (bar "baz")) (qux "quux"))))) (define (xml-identity xml) (pre-post-order* xml `((*default* . ,(lambda x x)) (*text* . ,(lambda (_ text) text))))) (xml-identity xml) ;; (*TOP* ((*PI* ((xml ("version=\"1.0\"")) (foo ((@ ((bar ("baz")))) (qux ("quux"))))))))