Update ooo320-m1
[ooovba.git] / writerfilter / source / doctok / tidyxmi.xsl
blob1c470039bf7cab0ee71e3fd2fe554b7e4dc627e9
1 <!--
2 /*************************************************************************
4 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 Copyright 2008 by Sun Microsystems, Inc.
8 OpenOffice.org - a multi-platform office productivity suite
10 $RCSfile: tidyxmi.xsl,v $
12 $Revision: 1.5 $
14 This file is part of OpenOffice.org.
16 OpenOffice.org is free software: you can redistribute it and/or modify
17 it under the terms of the GNU Lesser General Public License version 3
18 only, as published by the Free Software Foundation.
20 OpenOffice.org is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU Lesser General Public License version 3 for more details
24 (a copy is included in the LICENSE file that accompanied this code).
26 You should have received a copy of the GNU Lesser General Public License
27 version 3 along with OpenOffice.org. If not, see
28 <http://www.openoffice.org/license.html>
29 for a copy of the LGPLv3 License.
31 ************************************************************************/
32 -->
33 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:UML = 'org.omg.xmi.namespace.UML' xml:space="default">
34 <xsl:output indent="yes"/>
35 <xsl:template match="/">
36 <XMI xmi.version="1.2">
37 <XMI.header>
38 <XMI.documentation/>
39 </XMI.header>
40 <XMI.content>
41 <UML:Model xmlns:UML="org.omg.xmi.namespace.UML" name="WW8Document" >
42 <UML:Namespace.ownedElement>
43 <xsl:apply-templates select="XMI/XMI.content/UML:Model/UML:Namespace.ownedElement"/>
44 </UML:Namespace.ownedElement>
45 </UML:Model>
46 </XMI.content>
47 </XMI>
49 </xsl:template>
51 <xsl:template match="UML:Namespace.ownedElement">
52 <xsl:comment>Stereotypes </xsl:comment>
53 <xsl:copy-of select="UML:Stereotype"/>
54 <xsl:comment>Stereotypes</xsl:comment>
55 <xsl:comment>Datatypes </xsl:comment>
56 <xsl:copy-of select="UML:DataType"/>
57 <xsl:comment>Datatypes</xsl:comment>
58 <xsl:comment>Tag definitions </xsl:comment>
59 <xsl:copy-of select="UML:TagDefinition"/>
60 <xsl:comment>Tag definitions </xsl:comment>
61 <xsl:comment>Classes without stereotype</xsl:comment>
62 <xsl:apply-templates select="UML:Class[count(./UML:ModelElement.stereotype) = 0]"/>
63 <xsl:comment>Classes without stereotype</xsl:comment>
64 <xsl:comment>Resources</xsl:comment>
65 <xsl:copy-of select="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='resource']"/>
66 <xsl:comment>Resources</xsl:comment>
67 <xsl:comment>WW8 resources</xsl:comment>
68 <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]"/>
69 <xsl:comment>WW8 resources</xsl:comment>
70 <xsl:comment>SPRMS</xsl:comment>
71 <xsl:apply-templates select="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='ww8sprm']"/>
72 <xsl:comment>SPRMS</xsl:comment>
73 <xsl:comment>DFFS</xsl:comment>
74 <xsl:apply-templates select="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='dffrecord']"/>
75 <xsl:comment>DFFS</xsl:comment>
76 <xsl:comment>DFFOPT</xsl:comment>
77 <xsl:apply-templates select="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='dffopt']"/>
78 <xsl:comment>DFFOPT</xsl:comment>
79 </xsl:template>
81 <xsl:key name="generalization" match="UML:Generalization"
82 use="UML:Generalization.child/UML:Class/@xmi.idref"/>
84 <xsl:template match="UML:Class[count(UML:ModelElement.stereotype) = 0]">
85 <xsl:variable name="theid"><xsl:value-of select="@xmi.id"/></xsl:variable>
86 <xsl:comment>Class <xsl:value-of select="@xmi.id"/></xsl:comment>
87 <xsl:copy-of select="."/>
88 <xsl:copy-of select="key('generalization', $theid)"/>
89 <xsl:comment>Class <xsl:value-of select="@xmi.id"/></xsl:comment>
90 </xsl:template>
92 <xsl:template match="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='ww8resource' and count(UML:ModelElement.stereotype/UML:Stereotype[@xmi.idref='ww8sprm']) = 0]">
93 <xsl:variable name="theid"><xsl:value-of select="@xmi.id"/></xsl:variable>
94 <xsl:comment>Class <xsl:value-of select="@xmi.id"/></xsl:comment>
95 <xsl:copy-of select="."/>
96 <xsl:copy-of select="key('generalization', $theid)"/>
97 <xsl:comment>Class <xsl:value-of select="@xmi.id"/></xsl:comment>
98 </xsl:template>
100 <xsl:template match="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='ww8sprm']">
101 <xsl:variable name="theid"><xsl:value-of select="@xmi.id"/></xsl:variable>
102 <xsl:comment>SPRM <xsl:value-of select="@xmi.id"/></xsl:comment>
103 <xsl:copy-of select="."/>
104 <xsl:copy-of select="key('generalization', $theid)"/>
105 <xsl:comment>SPRM <xsl:value-of select="@xmi.id"/></xsl:comment>
106 </xsl:template>
108 <xsl:template match="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='dffrecord']">
109 <xsl:variable name="theid"><xsl:value-of select="@xmi.id"/></xsl:variable>
110 <xsl:comment>DFF <xsl:value-of select="@xmi.id"/></xsl:comment>
111 <xsl:copy-of select="."/>
112 <xsl:copy-of select="key('generalization', $theid)"/>
113 <xsl:comment>DFF <xsl:value-of select="@xmi.id"/></xsl:comment>
114 </xsl:template>
116 <xsl:template match="UML:Class[UML:ModelElement.stereotype/UML:Stereotype/@xmi.idref='dffopt']">
117 <xsl:variable name="theid"><xsl:value-of select="@xmi.id"/></xsl:variable>
118 <xsl:comment>DFFOPT <xsl:value-of select="@xmi.id"/></xsl:comment>
119 <xsl:copy-of select="."/>
120 <xsl:copy-of select="key('generalization', $theid)"/>
121 <xsl:comment>DFFOPT <xsl:value-of select="@xmi.id"/></xsl:comment>
122 </xsl:template>
124 </xsl:stylesheet>