samples/uml.yml2
author Volker Birk <vb@pep.foundation>
Thu, 26 Apr 2018 19:26:10 +0200
changeset 18 e14c2324eb0e
parent 0 76005e62091d
permissions -rw-r--r--
new distribution version
0
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     1
include yslt.yml2
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     2
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     3
decl UML is textstylesheet(
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     4
    xmlns:uml="http://schema.omg.org/spec/UML/2.1",
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     5
    xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     6
) {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     7
    output *output;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     8
    const "space", !"'" + " " * 200 + "'"!;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     9
    param "autoindent", 4;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    10
    template "text()";
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    11
    content;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    12
};
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    13
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    14
decl Root is template(match="/xmi:XMI/uml:Model/packagedElement"),
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    15
     All  is template(%match="*", match="//[%match]");
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    16
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    17
decl Package is template(
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    18
    %match="true()",
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    19
    match="packagedElement[@xmi:type='uml:Package' and (%match)]"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    20
);
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    21
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    22
decl applyPackages is apply (
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    23
    %match="true()",
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    24
    select="packagedElement[@xmi:type='uml:Package' and (%match)]"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    25
);
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    26
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    27
decl Class is template(
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    28
    %match="true()",
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    29
    match="packagedElement[@xmi:type='uml:Class' and (%match)]"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    30
);
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    31
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    32
decl applyClasses is apply (
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    33
    %match="true()",
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    34
    select="packagedElement[@xmi:type='uml:Class' and (%match)]"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    35
);
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    36
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    37
decl Attribute is template(
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    38
    %match="true()",
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    39
    match="ownedAttribute[@xmi:type='uml:Property' and type/@xmi:type='uml:PrimitiveType' and (%match)]"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    40
);
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    41
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    42
decl applyAttributes is apply (
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    43
    %match="true()",
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    44
    select="ownedAttribute[@xmi:type='uml:Property' and type/@xmi:type='uml:PrimitiveType' and (%match)]"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    45
);
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    46