Bump version to 4.1-6
[LibreOffice.git] / writerfilter / source / doctok / escherdoc.xsl
blob322a5b894a679c5b7f55358108dafaa09237f222
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 .
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 <out>
24 <xsl:for-each select="//xhtml:table">
25 <xsl:apply-templates select="." mode="eschertable"/>
26 </xsl:for-each>
27 </out>
28 </xsl:template>
30 <xsl:template match="xhtml:table" mode="eschertable">
31 <xsl:apply-templates select=".//xhtml:tr[position() > 1]" mode="eschertable"/>
32 </xsl:template>
34 <xsl:template match="xhtml:tr" mode="eschertable">
35 <xsl:variable name="name">
36 <xsl:value-of select=".//xhtml:td[1]"/>
37 </xsl:variable>
38 <UML:Class>
39 <xsl:attribute name="xmi.id">
40 <xsl:value-of select="$name"/>
41 </xsl:attribute>
42 <xsl:attribute name="name">
43 <xsl:value-of select="$name"/>
44 </xsl:attribute>
45 <UML:ModelElement.stereotype>
46 <UML:Stereotype xmi.idref="dffopt" />
47 </UML:ModelElement.stereotype>
48 <xsl:apply-templates select=".//xhtml:td[1]" mode="optname"/>
49 <xsl:apply-templates select=".//xhtml:td[2]" mode="fopid"/>
50 <xsl:apply-templates select=".//xhtml:td[3]" mode="type"/>
51 <xsl:apply-templates select=".//xhtml:td[4]" mode="default"/>
52 <xsl:apply-templates select=".//xhtml:td[5]" mode="comment"/>
53 </UML:Class>
54 </xsl:template>
56 <xsl:template match="xhtml:td" mode="optname">
57 <UML:ModelElement.taggedValue>
58 <UML:TaggedValue>
59 <UML:TaggedValue.dataValue>rtf:shp<xsl:value-of select="."/></UML:TaggedValue.dataValue>
60 <UML:TaggedValue.type>
61 <UML:TagDefinition xmi.idref="optname" />
62 </UML:TaggedValue.type>
63 </UML:TaggedValue>
64 </UML:ModelElement.taggedValue>
65 </xsl:template>
67 <xsl:template match="xhtml:td" mode="fopid">
68 <UML:ModelElement.taggedValue>
69 <UML:TaggedValue>
70 <UML:TaggedValue.dataValue><xsl:value-of select="."/></UML:TaggedValue.dataValue>
71 <UML:TaggedValue.type>
72 <UML:TagDefinition xmi.idref="fopid" />
73 </UML:TaggedValue.type>
74 </UML:TaggedValue>
75 </UML:ModelElement.taggedValue>
76 </xsl:template>
78 <xsl:template match="xhtml:td" mode="type">
79 <UML:ModelElement.taggedValue>
80 <UML:TaggedValue>
81 <UML:TaggedValue.dataValue>
82 <xsl:call-template name="saltype">
83 <xsl:with-param name="type" select="."/>
84 </xsl:call-template>
85 </UML:TaggedValue.dataValue>
86 <UML:TaggedValue.type>
87 <UML:TagDefinition xmi.idref="type" />
88 </UML:TaggedValue.type>
89 </UML:TaggedValue>
90 </UML:ModelElement.taggedValue>
91 <xsl:if test=".='BOOL'">
92 <UML:ModelElement.taggedValue>
93 <UML:TaggedValue>
94 <UML:TaggedValue.dataValue>1</UML:TaggedValue.dataValue>
95 <UML:TaggedValue.type>
96 <UML:TagDefinition xmi.idref="isbool" />
97 </UML:TaggedValue.type>
98 </UML:TaggedValue>
99 </UML:ModelElement.taggedValue>
100 </xsl:if>
101 </xsl:template>
103 <xsl:template match="xhtml:td" mode="default">
104 <UML:ModelElement.taggedValue>
105 <UML:TaggedValue>
106 <UML:TaggedValue.dataValue><xsl:value-of select="."/></UML:TaggedValue.dataValue>
107 <UML:TaggedValue.type>
108 <UML:TagDefinition xmi.idref="default" />
109 </UML:TaggedValue.type>
110 </UML:TaggedValue>
111 </UML:ModelElement.taggedValue>
112 </xsl:template>
114 <xsl:template match="xhtml:td" mode="comment">
115 <UML:ModelElement.taggedValue>
116 <UML:TaggedValue>
117 <UML:TaggedValue.dataValue><xsl:value-of select="."/></UML:TaggedValue.dataValue>
118 <UML:TaggedValue.type>
119 <UML:TagDefinition xmi.idref="comment" />
120 </UML:TaggedValue.type>
121 </UML:TaggedValue>
122 </UML:ModelElement.taggedValue>
123 </xsl:template>
125 <xsl:template name="saltype">
126 <xsl:param name="type"/>
127 <xsl:choose>
128 <xsl:when test="$type='LONG'">U32</xsl:when>
129 <xsl:when test="$type='BOOL'">U8</xsl:when>
130 <xsl:when test="$type='WCHAR*'">String</xsl:when>
131 <xsl:otherwise>unknown</xsl:otherwise>
132 </xsl:choose>
133 </xsl:template>
135 </xsl:stylesheet>