1<!--***********************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 ***********************************************************-->
21
22
23<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:UML = 'org.omg.xmi.namespace.UML' xml:space="default">
24<xsl:output indent="yes"/>
25<xsl:template match="/">
26<XMI xmi.version="1.2">
27  <XMI.header>
28    <XMI.documentation/>
29  </XMI.header>
30  <XMI.content>
31    <UML:Model xmlns:UML="org.omg.xmi.namespace.UML" name="WW8Document" >
32      <UML:Namespace.ownedElement>
33        <xsl:apply-templates select="XMI/XMI.content/UML:Model/UML:Namespace.ownedElement"/>
34      </UML:Namespace.ownedElement>
35    </UML:Model>
36  </XMI.content>
37</XMI>
38
39</xsl:template>
40
41<xsl:template match="UML:Namespace.ownedElement">
42  <xsl:comment>Stereotypes </xsl:comment>
43  <xsl:copy-of select="UML:Stereotype"/>
44  <xsl:comment>Stereotypes</xsl:comment>
45  <xsl:comment>Datatypes </xsl:comment>
46  <xsl:copy-of select="UML:DataType"/>
47  <xsl:comment>Datatypes</xsl:comment>
48  <xsl:comment>Tag definitions </xsl:comment>
49  <xsl:copy-of select="UML:TagDefinition"/>
50  <xsl:comment>Tag definitions </xsl:comment>
51  <xsl:comment>Classes without stereotype</xsl:comment>
52  <xsl:apply-templates select="UML:Class[count(./UML:ModelElement.stereotype) = 0]"/>
53  <xsl:comment>Classes without stereotype</xsl:comment>
54  <xsl:comment>Resources</xsl:comment>
55  <xsl:copy-of select="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='resource']"/>
56  <xsl:comment>Resources</xsl:comment>
57  <xsl:comment>WW8 resources</xsl:comment>
58  <xsl:apply-templates select="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='ww8resource' and count(UML:ModelElement.stereotype/UML:Stereotype[@xmi.idref='ww8sprm']) = 0]"/>
59  <xsl:comment>WW8 resources</xsl:comment>
60  <xsl:comment>SPRMS</xsl:comment>
61  <xsl:apply-templates select="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='ww8sprm']"/>
62  <xsl:comment>SPRMS</xsl:comment>
63  <xsl:comment>DFFS</xsl:comment>
64  <xsl:apply-templates select="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='dffrecord']"/>
65  <xsl:comment>DFFS</xsl:comment>
66  <xsl:comment>DFFOPT</xsl:comment>
67  <xsl:apply-templates select="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='dffopt']"/>
68  <xsl:comment>DFFOPT</xsl:comment>
69</xsl:template>
70
71<xsl:key name="generalization" match="UML:Generalization"
72         use="UML:Generalization.child/UML:Class/@xmi.idref"/>
73
74<xsl:template match="UML:Class[count(UML:ModelElement.stereotype) = 0]">
75  <xsl:variable name="theid"><xsl:value-of select="@xmi.id"/></xsl:variable>
76  <xsl:comment>Class <xsl:value-of select="@xmi.id"/></xsl:comment>
77  <xsl:copy-of select="."/>
78  <xsl:copy-of select="key('generalization', $theid)"/>
79  <xsl:comment>Class <xsl:value-of select="@xmi.id"/></xsl:comment>
80</xsl:template>
81
82<xsl:template match="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='ww8resource' and count(UML:ModelElement.stereotype/UML:Stereotype[@xmi.idref='ww8sprm']) = 0]">
83  <xsl:variable name="theid"><xsl:value-of select="@xmi.id"/></xsl:variable>
84  <xsl:comment>Class <xsl:value-of select="@xmi.id"/></xsl:comment>
85  <xsl:copy-of select="."/>
86  <xsl:copy-of select="key('generalization', $theid)"/>
87  <xsl:comment>Class <xsl:value-of select="@xmi.id"/></xsl:comment>
88</xsl:template>
89
90<xsl:template match="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='ww8sprm']">
91  <xsl:variable name="theid"><xsl:value-of select="@xmi.id"/></xsl:variable>
92  <xsl:comment>SPRM <xsl:value-of select="@xmi.id"/></xsl:comment>
93  <xsl:copy-of select="."/>
94  <xsl:copy-of select="key('generalization', $theid)"/>
95  <xsl:comment>SPRM <xsl:value-of select="@xmi.id"/></xsl:comment>
96</xsl:template>
97
98<xsl:template match="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='dffrecord']">
99  <xsl:variable name="theid"><xsl:value-of select="@xmi.id"/></xsl:variable>
100  <xsl:comment>DFF <xsl:value-of select="@xmi.id"/></xsl:comment>
101  <xsl:copy-of select="."/>
102  <xsl:copy-of select="key('generalization', $theid)"/>
103  <xsl:comment>DFF <xsl:value-of select="@xmi.id"/></xsl:comment>
104</xsl:template>
105
106<xsl:template match="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='dffopt']">
107  <xsl:variable name="theid"><xsl:value-of select="@xmi.id"/></xsl:variable>
108  <xsl:comment>DFFOPT <xsl:value-of select="@xmi.id"/></xsl:comment>
109  <xsl:copy-of select="."/>
110  <xsl:copy-of select="key('generalization', $theid)"/>
111  <xsl:comment>DFFOPT <xsl:value-of select="@xmi.id"/></xsl:comment>
112</xsl:template>
113
114</xsl:stylesheet>