2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 <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#"
19 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">
20 <xsl:output method=
"xml" indent=
"yes"/>
22 <xsl:template match=
"/">
23 <UML:Class xmi.
id=
"dummy" name=
"dummy">
24 <UML:ModelElement.stereotype
>
25 <UML:Stereotype xmi.idref='access'
/>
26 </UML:ModelElement.stereotype
>
27 <xsl:apply-templates select=
"//xhtml:body/xhtml:table"/>
31 <xsl:template match=
"xhtml:table">
32 <xsl:apply-templates select=
"xhtml:tbody/xhtml:tr[2]"/>
35 <xsl:template name=
"handleTR">
36 <xsl:param name=
"offset"/>
37 <xsl:param name=
"shift"/>
38 <xsl:variable name=
"name"><xsl:value-of select=
"xhtml:td[3]"/></xsl:variable>
39 <xsl:variable name=
"type">
41 <xsl:when test='contains(xhtml:td[
4],
"[")'
>
42 <xsl:value-of select='substring-before(xhtml:td[
4],
"[")'
/>
45 <xsl:value-of select=
"xhtml:td[4]"/>
46 <xsl:variable name=
"stereotype">attribute
</xsl:variable>
50 <xsl:variable name='stereotype'
>
52 <xsl:when test='contains(xhtml:td[
4],
"[")'
>array
</xsl:when>
53 <xsl:otherwise>attribute
</xsl:otherwise>
56 <xsl:variable name=
"saltype">
58 <xsl:when test=
"$type='U8'">sal_uInt8
</xsl:when>
59 <xsl:when test=
"$type='S8'">sal_Int8
</xsl:when>
60 <xsl:when test=
"$type='U16'">sal_uInt16
</xsl:when>
61 <xsl:when test=
"$type='S16'">sal_Int16
</xsl:when>
62 <xsl:when test=
"$type='U32'">sal_uInt32
</xsl:when>
63 <xsl:when test=
"$type='S32'">sal_Int32
</xsl:when>
64 <xsl:otherwise>void *
</xsl:otherwise>
67 <xsl:variable name=
"bits"><xsl:value-of select=
"xhtml:td[5]"/></xsl:variable>
68 <xsl:variable name=
"mask"><xsl:value-of select=
"xhtml:td[6]"/></xsl:variable>
69 <xsl:variable name=
"comment"><xsl:value-of select=
"xhtml:td[7]"/></xsl:variable>
70 <UML:Classifier.feature
>
71 <UML:Attribute><xsl:attribute name=
"name"><xsl:value-of select=
"$name"/></xsl:attribute>
72 <UML:ModelElement.taggedValue
>
74 <UML:TaggedValue.dataValue
><xsl:value-of select=
"$comment"/></UML:TaggedValue.dataValue
>
75 <UML:TaggedValue.type
>
76 <UML:TagDefinition xmi.idref = 'comment'
/>
77 </UML:TaggedValue.type
>
79 </UML:ModelElement.taggedValue
>
80 <UML:ModelElement.taggedValue
>
82 <UML:TaggedValue.dataValue
><xsl:value-of select=
"$offset"/></UML:TaggedValue.dataValue
>
83 <UML:TaggedValue.type
>
84 <UML:TagDefinition xmi.idref = 'offset'
/>
85 </UML:TaggedValue.type
>
87 </UML:ModelElement.taggedValue
>
88 <UML:ModelElement.taggedValue
>
90 <UML:TaggedValue.dataValue
><xsl:value-of select=
"$shift"/></UML:TaggedValue.dataValue
>
91 <UML:TaggedValue.type
>
92 <UML:TagDefinition xmi.idref = 'shift'
/>
93 </UML:TaggedValue.type
>
95 </UML:ModelElement.taggedValue
>
96 <UML:ModelElement.taggedValue
>
98 <UML:TaggedValue.dataValue
><xsl:value-of select=
"$mask"/></UML:TaggedValue.dataValue
>
99 <UML:TaggedValue.type
>
100 <UML:TagDefinition xmi.idref = 'mask'
/>
101 </UML:TaggedValue.type
>
103 </UML:ModelElement.taggedValue
>
104 <UML:ModelElement.taggedValue
>
106 <UML:TaggedValue.dataValue
><xsl:value-of select=
"$bits"/></UML:TaggedValue.dataValue
>
107 <UML:TaggedValue.type
>
108 <UML:TagDefinition xmi.idref = 'bits'
/>
109 </UML:TaggedValue.type
>
111 </UML:ModelElement.taggedValue
>
112 <UML:ModelElement.taggedValue
>
114 <UML:TaggedValue.dataValue
>rtf:
<xsl:value-of select='translate($name,
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ")'
/></UML:TaggedValue.dataValue
>
115 <UML:TaggedValue.type
>
116 <UML:TagDefinition xmi.idref = 'attrid'
/>
117 </UML:TaggedValue.type
>
119 </UML:ModelElement.taggedValue
>
120 <xsl:if test='$stereotype =
"array"'
>
121 <xsl:variable name='arraycount'
><xsl:value-of select='substring-before(substring-after(xhtml:td[
4],
"["),
"]")'
/></xsl:variable>
122 <UML:ModelElement.taggedValue
>
124 <UML:TaggedValue.dataValue
><xsl:value-of select=
"$arraycount"/></UML:TaggedValue.dataValue
>
125 <UML:TaggedValue.type
>
126 <UML:TagDefinition xmi.idref = 'arraycount'
/>
127 </UML:TaggedValue.type
>
129 </UML:ModelElement.taggedValue
>
131 <UML:StructuralFeature.type
>
132 <UML:DataType><xsl:attribute name=
"xmi.idref"><xsl:value-of select=
"$type"/></xsl:attribute></UML:DataType>
133 </UML:StructuralFeature.type
>
134 <UML:ModelElement.stereotype
>
135 <UML:Stereotype><xsl:attribute name=
"xmi.idref"><xsl:value-of select=
"$stereotype"/></xsl:attribute></UML:Stereotype>
136 </UML:ModelElement.stereotype
>
138 </UML:Classifier.feature
>
141 <xsl:template match=
"xhtml:tr[./xhtml:td[position()=1]/text()]">
142 <xsl:variable name=
"offset"><xsl:value-of select=
"xhtml:td[2]"/></xsl:variable>
143 <xsl:call-template name=
"handleTR">
144 <xsl:with-param name=
"offset" select=
"$offset"/>
145 <xsl:with-param name=
"shift">0</xsl:with-param>
147 <xsl:variable name=
"shift1"><xsl:value-of select=
"substring-after(xhtml:td[5], ':')"/></xsl:variable>
148 <xsl:apply-templates select=
"following-sibling::xhtml:tr[position()=1]">
149 <xsl:with-param name=
"offset" select=
"$offset"/>
150 <xsl:with-param name=
"shift" select=
"$shift1"/>
151 </xsl:apply-templates>
154 <xsl:template match=
"xhtml:tr[not(./xhtml:td[position()=1]/text())]">
155 <xsl:param name=
"offset"/>
156 <xsl:param name=
"shift"/>
157 <xsl:call-template name=
"handleTR">
158 <xsl:with-param name=
"offset" select=
"$offset"/>
159 <xsl:with-param name=
"shift" select=
"$shift"/>
161 <xsl:variable name=
"shift1"><xsl:value-of select=
"$shift+substring-after(xhtml:td[5], ':')"/></xsl:variable>
162 <xsl:apply-templates select=
"following-sibling::xhtml:tr[position()=1]">
163 <xsl:with-param name=
"offset" select=
"$offset"/>
164 <xsl:with-param name=
"shift" select=
"$shift1"/>
165 </xsl:apply-templates>
168 <xsl:template match=
"*">
169 <xsl:copy-of select=
"."/>