1 /*************************************************************************
3 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 Copyright
2008 by Sun Microsystems, Inc.
7 OpenOffice.org - a multi-platform office productivity suite
9 $RCSfile: escherdoc.xsl,v $
13 This file is part of OpenOffice.org.
15 OpenOffice.org is free software: you can redistribute it and/or modify
16 it under the terms of the GNU Lesser General Public License version
3
17 only, as published by the Free Software Foundation.
19 OpenOffice.org is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU Lesser General Public License version
3 for more details
23 (a copy is included in the LICENSE file that accompanied this code).
25 You should have received a copy of the GNU Lesser General Public License
26 version
3 along with OpenOffice.org. If not, see
27 <http://www.openoffice.org/license.html
>
28 for a copy of the LGPLv3 License.
30 ************************************************************************/
32 <xsl:stylesheet version=
"1.0" xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform" xmlns:
office=
"urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:
style=
"urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:
text=
"urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:
table=
"urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:
draw=
"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:
fo=
"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:
xlink=
"http://www.w3.org/1999/xlink" xmlns:
dc=
"http://purl.org/dc/elements/1.1/" xmlns:
meta=
"urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:
number=
"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:
svg=
"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:
chart=
"urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:
dr3d=
"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:
math=
"http://www.w3.org/1998/Math/MathML" xmlns:
form=
"urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:
script=
"urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:
config=
"urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:
ooo=
"http://openoffice.org/2004/office" xmlns:
ooow=
"http://openoffice.org/2004/writer" xmlns:
oooc=
"http://openoffice.org/2004/calc" xmlns:
dom=
"http://www.w3.org/2001/xml-events" xmlns:
xforms=
"http://www.w3.org/2002/xforms" xmlns:
xsd=
"http://www.w3.org/2001/XMLSchema" xmlns:
xsi=
"http://www.w3.org/2001/XMLSchema-instance" xmlns:
rdf=
"http://www.w3.org/1999/02/22-rdf-syntax-ns#"
33 xmlns:
rdfs=
"http://www.w3.org/2000/01/rdf-schema#" xmlns:UML = 'org.omg.xmi.namespace.UML' xml:
space=
"default" xmlns:
xhtml=
"http://www.w3.org/1999/xhtml">
34 <xsl:output method=
"xml" indent=
"yes"/>
36 <xsl:template match=
"/">
38 <xsl:for-each select=
"//xhtml:table">
39 <xsl:apply-templates select=
"." mode=
"eschertable"/>
44 <xsl:template match=
"xhtml:table" mode=
"eschertable">
45 <xsl:apply-templates select=
".//xhtml:tr[position() > 1]" mode=
"eschertable"/>
48 <xsl:template match=
"xhtml:tr" mode=
"eschertable">
49 <xsl:variable name=
"name">
50 <xsl:value-of select=
".//xhtml:td[1]"/>
53 <xsl:attribute name=
"xmi.id">
54 <xsl:value-of select=
"$name"/>
56 <xsl:attribute name=
"name">
57 <xsl:value-of select=
"$name"/>
59 <UML:ModelElement.stereotype
>
60 <UML:Stereotype xmi.
idref=
"dffopt" />
61 </UML:ModelElement.stereotype
>
62 <xsl:apply-templates select=
".//xhtml:td[1]" mode=
"optname"/>
63 <xsl:apply-templates select=
".//xhtml:td[2]" mode=
"fopid"/>
64 <xsl:apply-templates select=
".//xhtml:td[3]" mode=
"type"/>
65 <xsl:apply-templates select=
".//xhtml:td[4]" mode=
"default"/>
66 <xsl:apply-templates select=
".//xhtml:td[5]" mode=
"comment"/>
70 <xsl:template match=
"xhtml:td" mode=
"optname">
71 <UML:ModelElement.taggedValue
>
73 <UML:TaggedValue.dataValue
>rtf:shp
<xsl:value-of select=
"."/></UML:TaggedValue.dataValue
>
74 <UML:TaggedValue.type
>
75 <UML:TagDefinition xmi.
idref=
"optname" />
76 </UML:TaggedValue.type
>
78 </UML:ModelElement.taggedValue
>
81 <xsl:template match=
"xhtml:td" mode=
"fopid">
82 <UML:ModelElement.taggedValue
>
84 <UML:TaggedValue.dataValue
><xsl:value-of select=
"."/></UML:TaggedValue.dataValue
>
85 <UML:TaggedValue.type
>
86 <UML:TagDefinition xmi.
idref=
"fopid" />
87 </UML:TaggedValue.type
>
89 </UML:ModelElement.taggedValue
>
92 <xsl:template match=
"xhtml:td" mode=
"type">
93 <UML:ModelElement.taggedValue
>
95 <UML:TaggedValue.dataValue
>
96 <xsl:call-template name=
"saltype">
97 <xsl:with-param name=
"type" select=
"."/>
99 </UML:TaggedValue.dataValue
>
100 <UML:TaggedValue.type
>
101 <UML:TagDefinition xmi.
idref=
"type" />
102 </UML:TaggedValue.type
>
104 </UML:ModelElement.taggedValue
>
105 <xsl:if test=
".='BOOL'">
106 <UML:ModelElement.taggedValue
>
108 <UML:TaggedValue.dataValue
>1</UML:TaggedValue.dataValue
>
109 <UML:TaggedValue.type
>
110 <UML:TagDefinition xmi.
idref=
"isbool" />
111 </UML:TaggedValue.type
>
113 </UML:ModelElement.taggedValue
>
117 <xsl:template match=
"xhtml:td" mode=
"default">
118 <UML:ModelElement.taggedValue
>
120 <UML:TaggedValue.dataValue
><xsl:value-of select=
"."/></UML:TaggedValue.dataValue
>
121 <UML:TaggedValue.type
>
122 <UML:TagDefinition xmi.
idref=
"default" />
123 </UML:TaggedValue.type
>
125 </UML:ModelElement.taggedValue
>
128 <xsl:template match=
"xhtml:td" mode=
"comment">
129 <UML:ModelElement.taggedValue
>
131 <UML:TaggedValue.dataValue
><xsl:value-of select=
"."/></UML:TaggedValue.dataValue
>
132 <UML:TaggedValue.type
>
133 <UML:TagDefinition xmi.
idref=
"comment" />
134 </UML:TaggedValue.type
>
136 </UML:ModelElement.taggedValue
>
139 <xsl:template name=
"saltype">
140 <xsl:param name=
"type"/>
142 <xsl:when test=
"$type='LONG'">U32
</xsl:when>
143 <xsl:when test=
"$type='BOOL'">U8
</xsl:when>
144 <xsl:when test=
"$type='WCHAR*'">String
</xsl:when>
145 <xsl:otherwise>unknown
</xsl:otherwise>