import "Data/XML"
mapping relation MapNote Element Element
rule SectionsRule where
@when
MapNote ?noteA ?noteB
?sectionName <- ["from", "to", "heading", "body"]
@from
Attribute ?noteA ?sectionName ?text
@to
Element ?noteB ?sectionName ?el
TextContent ?el ?text
main () = do
doc = parseString """"""
doc2 = parseString ""
transformation OneShotForward where
MapNote (rootElementOf doc) (rootElementOf doc2)
print $ outputString doc2