[Haskell-cafe] Elementary HaXml question
Malcolm Wallace
Malcolm.Wallace at cs.york.ac.uk
Thu Feb 9 09:21:10 EST 2006
Koen.Roelandt at mineco.fgov.be writes:
> I'm new to Haskell and HaXml and I'm playing around with the latter to
> clean some (well-formed) 'legacy' html. This works fine except for the
> following cases. Some of the elements to be cleaned are:
>
> <font size="4"><i>Hello World</i></font>
> <i><font size="4">Hello World</font></i>
>
> This should become:
>
> <h1 class="subtitle">Hello World</h1>
>
> From what I could gather from the documentation, it should be something
> like:
>
> foldXml (txt ?> keep :>
> (attrval("size",AttValue[Left "4"]) `o` tag "font")
> /> tag "i" ?> replaceTag "h1" :> children)
Is the bracketing correct? I can't remember the precedence of the
operators offhand, but perhaps it should be
foldXml (txt ?> keep :>
(((attrval("size",AttValue[Left "4"]) `o` tag "font")
/> tag "i") ?> replaceTag "h1" :> children))
Regards,
Malcolm
More information about the Haskell-Cafe
mailing list