Bump version to 4.1-6
[LibreOffice.git] / writerfilter / source / doctok / WW8xmi.xsl
blob894d0cff9ef106e44c7b2c44d2a9021c0c06cc34
1 <!--
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 .
17 -->
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"/>
28 </UML:Class>
29 </xsl:template>
31 <xsl:template match="xhtml:table">
32 <xsl:apply-templates select="xhtml:tbody/xhtml:tr[2]"/>
33 </xsl:template>
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">
40 <xsl:choose>
41 <xsl:when test='contains(xhtml:td[4], "[")'>
42 <xsl:value-of select='substring-before(xhtml:td[4], "[")'/>
43 </xsl:when>
44 <xsl:otherwise>
45 <xsl:value-of select="xhtml:td[4]"/>
46 <xsl:variable name="stereotype">attribute</xsl:variable>
47 </xsl:otherwise>
48 </xsl:choose>
49 </xsl:variable>
50 <xsl:variable name='stereotype'>
51 <xsl:choose>
52 <xsl:when test='contains(xhtml:td[4], "[")'>array</xsl:when>
53 <xsl:otherwise>attribute</xsl:otherwise>
54 </xsl:choose>
55 </xsl:variable>
56 <xsl:variable name="saltype">
57 <xsl:choose>
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>
65 </xsl:choose>
66 </xsl:variable>
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>
73 <UML: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>
78 </UML:TaggedValue>
79 </UML:ModelElement.taggedValue>
80 <UML:ModelElement.taggedValue>
81 <UML: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>
86 </UML:TaggedValue>
87 </UML:ModelElement.taggedValue>
88 <UML:ModelElement.taggedValue>
89 <UML: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>
94 </UML:TaggedValue>
95 </UML:ModelElement.taggedValue>
96 <UML:ModelElement.taggedValue>
97 <UML: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>
102 </UML:TaggedValue>
103 </UML:ModelElement.taggedValue>
104 <UML:ModelElement.taggedValue>
105 <UML: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>
110 </UML:TaggedValue>
111 </UML:ModelElement.taggedValue>
112 <UML:ModelElement.taggedValue>
113 <UML: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>
118 </UML:TaggedValue>
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>
123 <UML: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>
128 </UML:TaggedValue>
129 </UML:ModelElement.taggedValue>
130 </xsl:if>
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>
137 </UML:Attribute>
138 </UML:Classifier.feature>
139 </xsl:template>
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>
146 </xsl:call-template>
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>
152 </xsl:template>
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"/>
160 </xsl:call-template>
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>
166 </xsl:template>
168 <xsl:template match="*">
169 <xsl:copy-of select="."/>
170 </xsl:template>
172 </xsl:stylesheet>