#!/usr/bin/guile -s !# (use-modules (ice-9 pretty-print) (sxml match)) (define (pp x) (pretty-print x) (newline)) (define (unbogus x) (sxml-match x ((a (@ . ,attrs) . ,rest) `(a (@ ,@(delete '(shape "rect") attrs)) . ,rest)) (,otherwise (if (string? x) x `(,(car x) ,(cadr x) ,@(map unbogus (cddr x))))))) (define one '(a (@ (shape "rect") (href "foo.html")) "kid")) (newline) (pp one) (pp (unbogus one)) (define bad `(p (@) "some text and " ,one " and " ,one)) (newline) (pp bad) (pp (unbogus bad))