[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Another lowdown->sxml-serializer problem
From: |
Matt Gushee |
Subject: |
Re: [Chicken-users] Another lowdown->sxml-serializer problem |
Date: |
Fri, 11 Oct 2013 19:43:24 -0600 |
That seems to work. Thank you very much!
On Fri, Oct 11, 2013 at 4:07 PM, Moritz Heidkamp
<address@hidden> wrote:
> Hi Matt,
>
> Matt Gushee <address@hidden> writes:
>> I have observed the following undesired behavior:
> [...]
>> Any solutions for this?
>
> I'm sorry that I didn't get around to changing Lowdown so that it
> produces SXML conformant with the spec, yet. In the meantime you can use
> this code to clean it up I think (works at least for your example):
>
> (use srfi-1 sxml-transforms)
>
> (define sxml-normalization-rules
> `((*text* . ,(lambda (_ x) (->string x)))
> (*default* . ,(lambda (tag children)
> (cons tag
> (append-map
> (lambda (x)
> (cond ((not (list? x)) (list x))
> ((null? x) x)
> ((symbol? (car x)) (list x))
> (else x)))
> children))))))
>
> (define (normalize-sxml doc)
> (pre-post-order* doc sxml-normalization-rules))
>
> Jim, maybe sxml-serializer can be patched so that it handles this
> situation in accordance with Postel's law, too?
>
> Hope that helps!
> Moritz