import "Data/XML" sexOfRole "father" = "Male" sexOfRole "mother" = "Female" sexOfRole "son" = "Male" sexOfRole "daughter" = "Female" mapping relation RootMapping Element Element rule PersonRule where @when RootMapping ?families ?persons @from Element ?families "Family" ?family Attribute ?family "lastName" ?lastName Element ?family ?role ?familyMember Attribute ?familyMember "firstName" ?firstName @to Element ?persons (sexOfRole ?role) ?person Attribute ?person "fullName" (?firstName + " " + ?lastName) main :: [String] -> () main [fileName] = do doc = parseFile fileName doc2 = parseString "" transformation OneShotForward where RootMapping (rootElementOf doc) (rootElementOf doc2) print $ outputString doc2