1<!--*********************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 ***********************************************************--> 21 22 23<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#" 24 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"> 25<xsl:output method="xml" indent="yes"/> 26 27<xsl:template match="/"> 28<UML:Class xmi.id="dummy" name="dummy"> 29 <UML:ModelElement.stereotype> 30 <UML:Stereotype xmi.idref='access'/> 31 </UML:ModelElement.stereotype> 32<xsl:apply-templates select="//xhtml:body/xhtml:table"/> 33</UML:Class> 34</xsl:template> 35 36<xsl:template match="xhtml:table"> 37<xsl:apply-templates select="xhtml:tbody/xhtml:tr[2]"/> 38</xsl:template> 39 40<xsl:template name="handleTR"> 41<xsl:param name="offset"/> 42<xsl:param name="shift"/> 43<xsl:variable name="name"><xsl:value-of select="xhtml:td[3]"/></xsl:variable> 44<xsl:variable name="type"> 45<xsl:choose> 46<xsl:when test='contains(xhtml:td[4], "[")'> 47<xsl:value-of select='substring-before(xhtml:td[4], "[")'/> 48</xsl:when> 49<xsl:otherwise> 50<xsl:value-of select="xhtml:td[4]"/> 51<xsl:variable name="stereotype">attribute</xsl:variable> 52</xsl:otherwise> 53</xsl:choose> 54</xsl:variable> 55<xsl:variable name='stereotype'> 56<xsl:choose> 57<xsl:when test='contains(xhtml:td[4], "[")'>array</xsl:when> 58<xsl:otherwise>attribute</xsl:otherwise> 59</xsl:choose> 60</xsl:variable> 61<xsl:variable name="saltype"> 62<xsl:choose> 63 <xsl:when test="$type='U8'">sal_uInt8</xsl:when> 64 <xsl:when test="$type='S8'">sal_Int8</xsl:when> 65 <xsl:when test="$type='U16'">sal_uInt16</xsl:when> 66 <xsl:when test="$type='S16'">sal_Int16</xsl:when> 67 <xsl:when test="$type='U32'">sal_uInt32</xsl:when> 68 <xsl:when test="$type='S32'">sal_Int32</xsl:when> 69 <xsl:otherwise>void *</xsl:otherwise> 70</xsl:choose> 71</xsl:variable> 72<xsl:variable name="bits"><xsl:value-of select="xhtml:td[5]"/></xsl:variable> 73<xsl:variable name="mask"><xsl:value-of select="xhtml:td[6]"/></xsl:variable> 74<xsl:variable name="comment"><xsl:value-of select="xhtml:td[7]"/></xsl:variable> 75 <UML:Classifier.feature> 76 <UML:Attribute><xsl:attribute name="name"><xsl:value-of select="$name"/></xsl:attribute> 77 <UML:ModelElement.taggedValue> 78 <UML:TaggedValue> 79 <UML:TaggedValue.dataValue><xsl:value-of select="$comment"/></UML:TaggedValue.dataValue> 80 <UML:TaggedValue.type> 81 <UML:TagDefinition xmi.idref = 'comment'/> 82 </UML:TaggedValue.type> 83 </UML:TaggedValue> 84 </UML:ModelElement.taggedValue> 85 <UML:ModelElement.taggedValue> 86 <UML:TaggedValue> 87 <UML:TaggedValue.dataValue><xsl:value-of select="$offset"/></UML:TaggedValue.dataValue> 88 <UML:TaggedValue.type> 89 <UML:TagDefinition xmi.idref = 'offset'/> 90 </UML:TaggedValue.type> 91 </UML:TaggedValue> 92 </UML:ModelElement.taggedValue> 93 <UML:ModelElement.taggedValue> 94 <UML:TaggedValue> 95 <UML:TaggedValue.dataValue><xsl:value-of select="$shift"/></UML:TaggedValue.dataValue> 96 <UML:TaggedValue.type> 97 <UML:TagDefinition xmi.idref = 'shift'/> 98 </UML:TaggedValue.type> 99 </UML:TaggedValue> 100 </UML:ModelElement.taggedValue> 101 <UML:ModelElement.taggedValue> 102 <UML:TaggedValue> 103 <UML:TaggedValue.dataValue><xsl:value-of select="$mask"/></UML:TaggedValue.dataValue> 104 <UML:TaggedValue.type> 105 <UML:TagDefinition xmi.idref = 'mask'/> 106 </UML:TaggedValue.type> 107 </UML:TaggedValue> 108 </UML:ModelElement.taggedValue> 109 <UML:ModelElement.taggedValue> 110 <UML:TaggedValue> 111 <UML:TaggedValue.dataValue><xsl:value-of select="$bits"/></UML:TaggedValue.dataValue> 112 <UML:TaggedValue.type> 113 <UML:TagDefinition xmi.idref = 'bits'/> 114 </UML:TaggedValue.type> 115 </UML:TaggedValue> 116 </UML:ModelElement.taggedValue> 117 <UML:ModelElement.taggedValue> 118 <UML:TaggedValue> 119 <UML:TaggedValue.dataValue>rtf:<xsl:value-of select='translate($name, "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")'/></UML:TaggedValue.dataValue> 120 <UML:TaggedValue.type> 121 <UML:TagDefinition xmi.idref = 'attrid'/> 122 </UML:TaggedValue.type> 123 </UML:TaggedValue> 124 </UML:ModelElement.taggedValue> 125<xsl:if test='$stereotype = "array"'> 126<xsl:variable name='arraycount'><xsl:value-of select='substring-before(substring-after(xhtml:td[4], "["), "]")'/></xsl:variable> 127 <UML:ModelElement.taggedValue> 128 <UML:TaggedValue> 129 <UML:TaggedValue.dataValue><xsl:value-of select="$arraycount"/></UML:TaggedValue.dataValue> 130 <UML:TaggedValue.type> 131 <UML:TagDefinition xmi.idref = 'arraycount'/> 132 </UML:TaggedValue.type> 133 </UML:TaggedValue> 134 </UML:ModelElement.taggedValue> 135</xsl:if> 136 <UML:StructuralFeature.type> 137 <UML:DataType><xsl:attribute name="xmi.idref"><xsl:value-of select="$type"/></xsl:attribute></UML:DataType> 138 </UML:StructuralFeature.type> 139 <UML:ModelElement.stereotype> 140 <UML:Stereotype><xsl:attribute name="xmi.idref"><xsl:value-of select="$stereotype"/></xsl:attribute></UML:Stereotype> 141 </UML:ModelElement.stereotype> 142 </UML:Attribute> 143 </UML:Classifier.feature> 144</xsl:template> 145 146<xsl:template match="xhtml:tr[./xhtml:td[position()=1]/text()]"> 147<xsl:variable name="offset"><xsl:value-of select="xhtml:td[2]"/></xsl:variable> 148<xsl:call-template name="handleTR"> 149<xsl:with-param name="offset" select="$offset"/> 150<xsl:with-param name="shift">0</xsl:with-param> 151</xsl:call-template> 152<xsl:variable name="shift1"><xsl:value-of select="substring-after(xhtml:td[5], ':')"/></xsl:variable> 153<xsl:apply-templates select="following-sibling::xhtml:tr[position()=1]"> 154<xsl:with-param name="offset" select="$offset"/> 155<xsl:with-param name="shift" select="$shift1"/> 156</xsl:apply-templates> 157</xsl:template> 158 159<xsl:template match="xhtml:tr[not(./xhtml:td[position()=1]/text())]"> 160<xsl:param name="offset"/> 161<xsl:param name="shift"/> 162<xsl:call-template name="handleTR"> 163<xsl:with-param name="offset" select="$offset"/> 164<xsl:with-param name="shift" select="$shift"/> 165</xsl:call-template> 166<xsl:variable name="shift1"><xsl:value-of select="$shift+substring-after(xhtml:td[5], ':')"/></xsl:variable> 167<xsl:apply-templates select="following-sibling::xhtml:tr[position()=1]"> 168<xsl:with-param name="offset" select="$offset"/> 169<xsl:with-param name="shift" select="$shift1"/> 170</xsl:apply-templates> 171</xsl:template> 172 173<xsl:template match="*"> 174<xsl:copy-of select="."/> 175</xsl:template> 176 177</xsl:stylesheet> 178