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

Koen.Roelandt@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>
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

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.
Not exactly. In the end I want to turn both tags into one <h1>: <em><font size="4">Hello World</font></em> and <font size="4"><em>Hello World</em></font> should both become <h1 class="subtitle">Hello World</h1> The second case works now (cf. my previous post). <em> still appears, but I guess I can deal with that by refining the filters. The current problem is that I can 'find' <em> in <font> but not <font> in <em>, which puzzles me. Regards, Koen.
participants (2)
-
Koen.Roelandt@mineco.fgov.be
-
Malcolm Wallace