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<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#"
23                xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:UML = 'org.omg.xmi.namespace.UML' xml:space="default">
24  <xsl:output method="text" />
25
26  <!-- Key all attributes with the same name and same value -->
27  <xsl:key name="same-valued-tagged-data"
28           match="UML:TaggedValue.dataValue" use="." />
29
30  <xsl:template match="/">
31    <out>
32      <xsl:text>
33/*
34
35   THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT!
36
37*/
38
39package analyze;
40
41import java.util.LinkedHashMap;
42
43/**
44 *
45 * @author hb137859
46 */
47public class ResourceIdMapBackwards extends LinkedHashMap &lt;Integer, String &gt; {
48
49    static ResourceIdMapBackwards mInstance = new ResourceIdMapBackwards();
50
51    /** Creates a new instance of ResourceIdMapBackwards */
52    protected ResourceIdMapBackwards() {
53/* Attributes */&#xa;</xsl:text>
54      <xsl:for-each select='.//UML:Attribute[@name!="reserved"][count(.//UML:Stereotype[@xmi.idref="noqname"]) = 0]//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="attrid"]'>
55        <xsl:choose>
56          <xsl:when test='generate-id(UML:TaggedValue.dataValue) != generate-id(key("same-valued-tagged-data", UML:TaggedValue.dataValue)[1])'/>
57          <!-- <xsl:when test='.//UML:TaggedValue.dataValue = preceding::*//UML:TaggedValue.dataValue'/>-->
58          <xsl:otherwise>
59            <xsl:text>put(</xsl:text>
60            <xsl:value-of select='10000 + position()'/>
61            <xsl:text>, "</xsl:text>
62            <xsl:call-template name='idtoqname'>
63              <xsl:with-param name='id'><xsl:value-of select='.//UML:TaggedValue.dataValue'/></xsl:with-param>
64            </xsl:call-template>
65            <xsl:text>");&#xa;</xsl:text>
66          </xsl:otherwise>
67        </xsl:choose>
68      </xsl:for-each>
69      <xsl:text>
70
71/* Operations */&#xa;</xsl:text>
72      <xsl:for-each select='.//UML:Operation[@name!="reserved"][count(.//UML:Stereotype[@xmi.idref="noqname"]) = 0]//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="opid"]'>
73        <xsl:choose>
74          <xsl:when test='generate-id(UML:TaggedValue.dataValue) != generate-id(key("same-valued-tagged-data", UML:TaggedValue.dataValue)[1])'/>
75          <xsl:otherwise>
76            <xsl:text>put(</xsl:text>
77            <xsl:value-of select='20000 + position()'/>
78            <xsl:text>, "</xsl:text>
79            <xsl:call-template name='idtoqname'>
80              <xsl:with-param name='id'><xsl:value-of select='.//UML:TaggedValue.dataValue'/></xsl:with-param>
81            </xsl:call-template>
82            <xsl:text>"); &#xa;</xsl:text>
83          </xsl:otherwise>
84        </xsl:choose>
85      </xsl:for-each>
86      <xsl:text>
87
88/* Classes */&#xa;</xsl:text>
89      <xsl:for-each select='.//UML:Class[@name!="reserved"]//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="classid"]'>
90        <xsl:choose>
91          <xsl:when test='.//UML:Stereotype[@xmi.idref="noqname"]'/>
92          <xsl:when test='generate-id(UML:TaggedValue.dataValue) != generate-id(key("same-valued-tagged-data", UML:TaggedValue.dataValue)[1])'/>
93          <xsl:otherwise>
94            <xsl:text>put(</xsl:text>
95            <xsl:value-of select='30000 + position()'/>
96            <xsl:text>, "</xsl:text>
97            <xsl:call-template name='idtoqname'>
98              <xsl:with-param name='id'><xsl:value-of select='.//UML:TaggedValue.dataValue'/></xsl:with-param>
99            </xsl:call-template>
100            <xsl:text>"); &#xa;</xsl:text>
101          </xsl:otherwise>
102        </xsl:choose>
103      </xsl:for-each>
104      <xsl:text>
105   }
106
107   static ResourceIdMapBackwards instance() {
108       return mInstance;
109   }
110};
111</xsl:text>
112</out>
113</xsl:template>
114
115  <xsl:template name='idtoqname'>
116    <xsl:param name='id'/>rtf:<xsl:value-of select='substring-after($id, ":")'/>
117  </xsl:template>
118
119</xsl:stylesheet>
120