X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.data%2Fexamples%2FXMLTransformationTest2.scl;fp=bundles%2Forg.simantics.scl.data%2Fexamples%2FXMLTransformationTest2.scl;h=63ce384894273778f77b22abcfabff0352ff94ca;hp=18041bc6290cfe35a1f28123833d9f63ee26d3f0;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.scl.data/examples/XMLTransformationTest2.scl b/bundles/org.simantics.scl.data/examples/XMLTransformationTest2.scl index 18041bc62..63ce38489 100644 --- a/bundles/org.simantics.scl.data/examples/XMLTransformationTest2.scl +++ b/bundles/org.simantics.scl.data/examples/XMLTransformationTest2.scl @@ -1,32 +1,32 @@ -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 +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