how to unwrap a tag in pre-post-order
Oleg Parashchenko <olpa-1YK4M1/[email protected]> Wed, 17 Aug 2011 13:47:57 +0200
| Newsgroups | gmane.lisp.scheme.ssax-sxml |
|---|---|
| Organization | private person |
| Message-ID | <[email protected]> |
Hello, I try to "unwrap" an XML tag: delete the tag, but retain the subtrees. For example, the source document: <chapter> <proxy><section></section></proxy> <proxy><section></section></proxy> </chapter> after unwrapping the tag "proxy" gives: <chapter> <section/> <section/> </chapter> A first attempt with SXSLT: (define doc '(*TOP* (chapter (proxy (section)) (proxy (section))))) (define unwrapped (pre-post-order doc `( (*default* . ,(lambda args args)) (proxy . ,(lambda (tag . kids) kids)) ))) (display unwrapped)(newline) The result is: (*TOP* (chapter ((section)) ((section)))) But I want: (*TOP* (chapter (section) (section))) Any trick to get the desired result? The idea is to apply several "pre-post-order" in sequence, and mix them with sxpath expressions. But right now the result of a transformation is not SXML anymore. Any suggestions are welcome. -- Oleg Parashchenko olpa@ http://uucode.com/ http://uucode.com/blog/ XML, TeX, Python, Mac, Chess ------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2