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