3 mapping relation MapNote Element Element
\r
5 rule SectionsRule where
\r
7 MapNote ?noteA ?noteB
\r
8 ?sectionName <- ["from", "to", "heading", "body"]
\r
11 Attribute ?noteA ?sectionName ?text
\r
14 Element ?noteB ?sectionName ?el
\r
15 TextContent ?el ?text
\r
18 doc = parseString """<note to="Tove" from="Jani" heading="Reminder" body="Don't forget me this weekend!"/>"""
\r
20 doc2 = parseString "<note/>"
\r
22 transformation OneShotForward where
\r
23 MapNote (rootElementOf doc) (rootElementOf doc2)
\r
25 print $ outputString doc2
\r