Betreft: Re: [Haskell-cafe] Elementary HaXml question

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Thu Feb 9 10:33:40 EST 2006


Koen.Roelandt at mineco.fgov.be writes:

>         foldXml     (txt ?> keep :>
>                         fontSize4 /> tag "em" ?> mkSubtitle             :>
>                         children)
> now transforms
>         <font size="4"><em>Hello World</em></font>
> into
>         <h1 class="subtitle"><em><Hello World</em></font>
> 
> I still have a problem with the other example:
>         <em><font size="4">Hello World</font></em>

Ah, I see.  In the first case, you simply change the <font> tag into
<h1>, keeping the <em> tag exactly the same.  But in the second case,
you not only want to change <font> into <h1>, but also to move the <em>
tag from outside the <font> to inside.

I think you need something like this:

     mkSubtitle `o` (tag "em" /> fontSize4 /> mkElem "em") |>| children

i.e. build an <em> around the children of the <font> tag, and then
build the <h1> subtitle around the outside of that.

Regards,
    Malcolm


More information about the Haskell-Cafe mailing list