]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.data/examples/XMLTransformationTest.scl
Change jersey back to 2.25.1 from 2.26 to fix resource-locator problems
[simantics/platform.git] / bundles / org.simantics.scl.data / examples / XMLTransformationTest.scl
1 import "Data/XML"
2
3 mapping relation MapNote Element Element
4
5 rule SectionsRule where
6     @when
7     MapNote ?noteA ?noteB
8     ?sectionName <- ["from", "to", "heading", "body"]
9     
10     @from
11     Attribute ?noteA ?sectionName ?text
12     
13     @to
14     Element ?noteB ?sectionName ?el
15     TextContent ?el ?text
16     
17 main () = do
18     doc = parseString """<note to="Tove" from="Jani" heading="Reminder" body="Don't forget me this weekend!"/>"""
19
20     doc2 = parseString "<note/>"
21
22     transformation OneShotForward where
23         MapNote (rootElementOf doc) (rootElementOf doc2)
24     
25     print $ outputString doc2
26