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">
25<xsl:output method="text" />
26
27<xsl:template name='idtoqname'>
28  <xsl:param name='id'/>
29  <xsl:text>NS_</xsl:text>
30  <xsl:value-of select='substring-before($id, ":")'/>
31  <xsl:text>::LN_</xsl:text>
32  <xsl:value-of select='substring-after($id, ":")'/>
33</xsl:template>
34
35<xsl:template name="parenttype">
36  <xsl:param name='type'/>
37  <xsl:for-each select='/XMI/XMI.content/UML:Model/UML:Namespace.ownedElement/UML:Generalization[UML:Generalization.child/UML:Class/@xmi.idref=$type]'>
38    <xsl:value-of select='./UML:Generalization.parent/UML:Class/@xmi.idref'/>
39  </xsl:for-each>
40</xsl:template>
41
42<xsl:template name='saltype'>
43  <xsl:param name='type'/>
44  <xsl:param name='parenttype'/>
45  <xsl:choose>
46    <xsl:when test="$type='U8'">sal_uInt8</xsl:when>
47    <xsl:when test="$type='S8'">sal_Int8</xsl:when>
48    <xsl:when test="$type='U16'">sal_uInt16</xsl:when>
49    <xsl:when test="$type='S16'">sal_Int16</xsl:when>
50    <xsl:when test="$type='U32'">sal_uInt32</xsl:when>
51    <xsl:when test="$type='S32'">sal_Int32</xsl:when>
52    <xsl:when test="$type='String'">rtl::OUString</xsl:when>
53    <xsl:otherwise>
54      <xsl:text>writerfilter::Reference &lt; </xsl:text>
55      <xsl:value-of select='$parenttype'/>
56      <xsl:text> &gt;::Pointer_t</xsl:text>
57    </xsl:otherwise>
58  </xsl:choose>
59</xsl:template>
60
61<xsl:template name='typetype'>
62  <xsl:param name='type'/><xsl:choose>
63  <xsl:when test="$type='U8'">simple</xsl:when>
64  <xsl:when test="$type='S8'">simple</xsl:when>
65  <xsl:when test="$type='U16'">simple</xsl:when>
66  <xsl:when test="$type='S16'">simple</xsl:when>
67  <xsl:when test="$type='U32'">simple</xsl:when>
68  <xsl:when test="$type='S32'">simple</xsl:when>
69  <xsl:when test="$type='String'">string</xsl:when>
70  <xsl:when test="$type='Binary'">binary</xsl:when>
71  <xsl:otherwise>complex</xsl:otherwise>
72</xsl:choose>
73</xsl:template>
74
75<xsl:template name="valuetype">
76  <xsl:param name="type"/>
77  <xsl:choose>
78    <xsl:when test='$type="U8"'>WW8IntValue</xsl:when>
79    <xsl:when test='$type="S8"'>WW8IntValue</xsl:when>
80    <xsl:when test='$type="U16"'>WW8IntValue</xsl:when>
81    <xsl:when test='$type="S16"'>WW8IntValue</xsl:when>
82    <xsl:when test='$type="U32"'>WW8IntValue</xsl:when>
83    <xsl:when test='$type="S32"'>WW8IntValue</xsl:when>
84    <xsl:otherwise>WW8PropertiesValue</xsl:otherwise>
85  </xsl:choose>
86</xsl:template>
87
88<xsl:template match="UML:Attribute" mode="valuetype">
89  <xsl:call-template name="valuetype">
90    <xsl:with-param name="type" select='.//UML:DataType/@xmi.idref'/>
91  </xsl:call-template>
92</xsl:template>
93
94<xsl:template name="qnametostrattrs">
95  <xsl:text>
96    /* Attributes */</xsl:text>
97    <xsl:for-each select='.//UML:Attribute[@name!="reserved"]'>
98      <xsl:for-each select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="attrid"]'>
99        <xsl:choose>
100          <xsl:when test='.//UML:Stereotype[@xmi.idref="noresolve"]'>
101          </xsl:when>
102          <xsl:otherwise>
103            <xsl:text>
104    mMap[</xsl:text>
105    <xsl:call-template name='idtoqname'>
106      <xsl:with-param name='id'><xsl:value-of select='.//UML:TaggedValue.dataValue'/></xsl:with-param>
107    </xsl:call-template>
108    <xsl:text>] = "</xsl:text>
109    <xsl:value-of select='.//UML:TaggedValue.dataValue'/>
110    <xsl:text>";</xsl:text>
111          </xsl:otherwise>
112        </xsl:choose>
113      </xsl:for-each>
114    </xsl:for-each>
115</xsl:template>
116
117<xsl:template name="qnametostrops">
118  <xsl:text>
119    /* Operations */</xsl:text>
120    <xsl:for-each select='.//UML:Operation[@name!="reserved"]'>
121      <xsl:for-each select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="opid"]'>
122        <xsl:choose>
123          <xsl:when test='.//UML:Stereotype[@xmi.idref="noresolve"]'>
124          </xsl:when>
125          <xsl:otherwise>
126            <xsl:text>
127    mMap[</xsl:text>
128    <xsl:call-template name='idtoqname'>
129      <xsl:with-param name='id'><xsl:value-of select='.//UML:TaggedValue.dataValue'/></xsl:with-param>
130    </xsl:call-template>
131    <xsl:text>] = "</xsl:text>
132    <xsl:value-of select='.//UML:TaggedValue.dataValue'/>
133    <xsl:text>";</xsl:text>
134          </xsl:otherwise>
135        </xsl:choose>
136      </xsl:for-each>
137    </xsl:for-each>
138</xsl:template>
139
140<xsl:template name="qnametostrclasses">
141  <xsl:text>
142    /* Classes */</xsl:text>
143    <xsl:for-each select='.//UML:Class[@name!="reserved"]'>
144      <xsl:for-each select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="classid"]'>
145        <xsl:text>
146    mMap[</xsl:text>
147    <xsl:call-template name='idtoqname'>
148      <xsl:with-param name='id'><xsl:value-of select='.//UML:TaggedValue.dataValue'/></xsl:with-param>
149    </xsl:call-template>
150    <xsl:text>] = "</xsl:text>
151    <xsl:value-of select='.//UML:TaggedValue.dataValue'/>
152    <xsl:text>";</xsl:text>
153      </xsl:for-each>
154    </xsl:for-each>
155</xsl:template>
156
157<xsl:template match='UML:Model' mode='qnametostr'>
158  <xsl:text>
159void QNameToString::init_doctok()
160{</xsl:text>
161<xsl:call-template name="qnametostrattrs"/>
162<xsl:call-template name="qnametostrops"/>
163<xsl:call-template name="qnametostrclasses"/>
164<xsl:text>
165}
166</xsl:text>
167</xsl:template>
168
169<xsl:key name="ids" match='UML:Attribute[@name!="reserved"]//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="attrid"]|UML:Operation[@name!="reserved"]//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="opid"]' use=".//UML:TaggedValue.dataValue"/>
170
171<xsl:template match="UML:Model" mode="qnametostrfunc">
172  <xsl:text>
173string qnameToString(sal_uInt32 nToken)
174{
175    string sResult;
176
177    switch (nToken)
178    {
179       // Attributes</xsl:text>
180       <xsl:for-each select='.//UML:Attribute[@name!="reserved"]//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="attrid"]'>
181         <xsl:choose>
182           <xsl:when test='.//UML:Stereotype[@xmi.idref="noresolve"]'>
183           </xsl:when>
184           <xsl:otherwise>
185             <xsl:if test="generate-id(key('ids', .//UML:TaggedValue.dataValue)[1])=generate-id(.)">
186               <xsl:text>
187    case </xsl:text>
188    <xsl:call-template name='idtoqname'>
189      <xsl:with-param name='id'><xsl:value-of select='.//UML:TaggedValue.dataValue'/></xsl:with-param>
190    </xsl:call-template>
191    <xsl:text>:
192        sResult = "</xsl:text>
193        <xsl:value-of select='.//UML:TaggedValue.dataValue'/>
194        <xsl:text>";
195        break;</xsl:text>
196             </xsl:if>
197           </xsl:otherwise>
198         </xsl:choose>
199       </xsl:for-each>
200       <xsl:text>
201       // Operations</xsl:text>
202       <xsl:for-each select='.//UML:Operation[@name!="reserved"]//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="opid"]'>
203         <xsl:choose>
204           <xsl:when test='.//UML:Stereotype[@xmi.idref="noresolve"]'>
205           </xsl:when>
206           <xsl:otherwise>
207             <xsl:if test="generate-id(key('ids', .//UML:TaggedValue.dataValue)[1])=generate-id(.)">
208               <xsl:text>
209    case </xsl:text>
210    <xsl:call-template name='idtoqname'>
211      <xsl:with-param name='id'><xsl:value-of select='.//UML:TaggedValue.dataValue'/></xsl:with-param>
212    </xsl:call-template>
213    <xsl:text>:
214        sResult = "</xsl:text>
215        <xsl:value-of select='.//UML:TaggedValue.dataValue'/>
216        <xsl:text>";
217        break;</xsl:text>
218             </xsl:if>
219           </xsl:otherwise>
220         </xsl:choose>
221       </xsl:for-each>
222       <xsl:text>
223       // Classes:</xsl:text>
224       <xsl:for-each select='.//UML:Class[@name!="reserved"]//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="classid"]'>
225         <xsl:text>
226    case </xsl:text>
227       <xsl:call-template name='idtoqname'>
228         <xsl:with-param name='id'><xsl:value-of select='.//UML:TaggedValue.dataValue'/></xsl:with-param>
229       </xsl:call-template>
230       <xsl:text>:
231        sResult = "</xsl:text>
232        <xsl:value-of select='.//UML:TaggedValue.dataValue'/>
233        <xsl:text>";
234        break;</xsl:text>
235       </xsl:for-each>
236       <xsl:text>
237    default:
238        ;
239    }
240
241    return sResult;
242}</xsl:text>
243</xsl:template>
244
245<xsl:template match='UML:Model' mode='sprmcodetostr'>
246<xsl:text>
247SprmIdToString::SprmIdToString()
248{</xsl:text>
249<xsl:variable name='tmp'>map &lt; sal_uInt32, string &gt; </xsl:variable>
250<xsl:for-each select='.//UML:Class[.//UML:Stereotype/@xmi.idref="ww8sprm"]'>
251  <xsl:variable name="sprmconst">
252    <xsl:call-template name="sprmCodeOfClass"/>
253  </xsl:variable>
254  <xsl:text>
255    mMap[</xsl:text>
256  <xsl:value-of select="$sprmconst"/>
257  <xsl:text>] = "</xsl:text>
258  <xsl:value-of select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="sprmid"]//UML:TaggedValue.dataValue'/>
259  <xsl:text>";</xsl:text>
260</xsl:for-each>
261<xsl:text>
262}
263</xsl:text>
264</xsl:template>
265
266<xsl:key name="classes-with-kind" match="UML:TagDefinition[@xmi.idref='kind']"
267         use="ancestor::UML:TaggedValue/UML:TaggedValue.dataValue"/>
268
269<xsl:template name="sprmCodeOfClass">
270  <xsl:variable name="tmp">
271    <xsl:text>sprm:</xsl:text>
272    <xsl:value-of select="substring-after(@name, 'sprm')"/>
273  </xsl:variable>
274  <xsl:call-template name="idtoqname">
275    <xsl:with-param name="id" select="$tmp"/>
276  </xsl:call-template>
277</xsl:template>
278
279<xsl:template name="sprmkindcase">
280  <xsl:param name="kind"/>
281  <xsl:for-each select="key('classes-with-kind', $kind)/ancestor::UML:Class">
282    <xsl:text>
283    case </xsl:text>
284    <xsl:call-template name="sprmCodeOfClass"/>
285    <xsl:text>:</xsl:text>
286  </xsl:for-each>
287</xsl:template>
288
289<xsl:template match="UML:Model" mode='sprmkind'>
290<xsl:text>
291Sprm::Kind SprmKind(sal_uInt32 sprmCode)
292{
293    Sprm::Kind nResult = Sprm::UNKNOWN;
294
295    switch(sprmCode)
296    {</xsl:text>
297    <xsl:call-template name="sprmkindcase">
298      <xsl:with-param name="kind">paragraph</xsl:with-param>
299    </xsl:call-template>
300    <xsl:text>
301      nResult = Sprm::PARAGRAPH;
302      break;</xsl:text>
303    <xsl:call-template name="sprmkindcase">
304      <xsl:with-param name="kind">character</xsl:with-param>
305    </xsl:call-template>
306    <xsl:text>
307      nResult = Sprm::CHARACTER;
308      break;</xsl:text>
309    <xsl:call-template name="sprmkindcase">
310      <xsl:with-param name="kind">table</xsl:with-param>
311    </xsl:call-template>
312    <xsl:text>
313      nResult = Sprm::TABLE;
314      break;</xsl:text>
315    <xsl:text>
316    default:
317      break;
318    }
319
320    return nResult;
321}
322</xsl:text>
323</xsl:template>
324
325<xsl:template match="UML:Model" mode='sprmids'>
326  <xsl:text>
327namespace NS_sprm { </xsl:text>
328  <xsl:for-each select=".//UML:Class[.//UML:Stereotype/@xmi.idref='ww8sprm']">
329    <xsl:variable name="sprmcode">
330      <xsl:value-of select=".//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref = 'sprmcode']/UML:TaggedValue.dataValue"/>
331    </xsl:variable>
332    <xsl:variable name="sprmcodelower">
333      <xsl:value-of select="translate($sprmcode, 'ABCDEF', 'abcdef')"/>
334    </xsl:variable>
335    <xsl:variable name="sprmidname">
336      <xsl:text>LN_</xsl:text>
337      <xsl:value-of select="substring-after(@name, 'sprm')"/>
338    </xsl:variable>
339    <xsl:text>
340    const sal_uInt16 </xsl:text>
341    <xsl:value-of select="$sprmidname"/>
342    <xsl:text> = </xsl:text>
343    <xsl:value-of select="$sprmcodelower"/>
344    <xsl:text>;</xsl:text>
345  </xsl:for-each>
346  <xsl:text>
347}
348</xsl:text>
349</xsl:template>
350
351<xsl:template match="UML:Model" mode='sprmidsed'>
352  <xsl:text>#!/bin/sh
353  cat $1 \&#xa;</xsl:text>
354  <xsl:for-each select=".//UML:Class[.//UML:Stereotype/@xmi.idref='ww8sprm']">
355    <xsl:variable name="sprmcode">
356      <xsl:value-of select=".//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref = 'sprmcode']/UML:TaggedValue.dataValue"/>
357    </xsl:variable>
358    <xsl:variable name="sprmcodelower">
359      <xsl:value-of select="translate($sprmcode, 'ABCDEF', 'abcdef')"/>
360    </xsl:variable>
361    <xsl:variable name="sprmidname">
362      <xsl:text>NS_sprm::LN_</xsl:text>
363      <xsl:value-of select="substring-after(@name, 'sprm')"/>
364    </xsl:variable>
365    <xsl:text>| sed "s/</xsl:text>
366<xsl:value-of select="$sprmcode"/>
367<xsl:text>/</xsl:text>
368<xsl:value-of select="$sprmidname"/>
369<xsl:text>/g" \&#xa;</xsl:text>
370    <xsl:text>| sed "s/</xsl:text>
371<xsl:value-of select="$sprmcodelower"/>
372<xsl:text>/</xsl:text>
373<xsl:value-of select="$sprmidname"/>
374<xsl:text>/g" \&#xa;</xsl:text>
375  </xsl:for-each>
376  <xsl:text> | cat&#xa;</xsl:text>
377</xsl:template>
378
379<xsl:template match="UML:Model" mode="sprmidstoxml">
380  <xsl:text>
381void sprmidsToXML(::std::ostream &amp; out)
382{
383  </xsl:text>
384  <xsl:for-each select=".//UML:Class[.//UML:Stereotype/@xmi.idref='ww8sprm']">
385    <xsl:variable name="sprmcode">
386      <xsl:value-of select=".//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref = 'sprmcode']/UML:TaggedValue.dataValue"/>
387    </xsl:variable>
388    <xsl:variable name="sprmcodelower">
389      <xsl:value-of select="translate($sprmcode, 'ABCDEF', 'abcdef')"/>
390    </xsl:variable>
391    <xsl:variable name="sprmidname">
392      <xsl:text>sprm:</xsl:text>
393      <xsl:value-of select="substring-after(@name, 'sprm')"/>
394    </xsl:variable>
395    <xsl:text>
396    out &lt;&lt; "&lt;theid name=\"</xsl:text>
397    <xsl:value-of select="$sprmidname"/>
398    <xsl:text>\"&gt;</xsl:text>
399    <xsl:value-of select="$sprmcodelower"/>
400    <xsl:text>&lt;/theid&gt;" &lt;&lt; endl;</xsl:text>
401  </xsl:for-each>
402  <xsl:text>
403}
404  </xsl:text>
405</xsl:template>
406
407<xsl:template match="UML:Model" mode='sprmreplace'>
408  <xsl:for-each select=".//UML:Class[.//UML:Stereotype/@xmi.idref='ww8sprm']">
409    <xsl:variable name="pattern">
410      <xsl:value-of select=".//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref = 'sprmcode']/UML:TaggedValue.dataValue"/>
411    </xsl:variable>
412    <xsl:variable name="lowerpattern">
413      <xsl:value-of select="translate($pattern, 'ABCDEF', 'abcdef')"/>
414    </xsl:variable>
415    <xsl:variable name="upperpattern">
416      <xsl:value-of select="translate($pattern, 'abcdef', 'ABCDEF')"/>
417    </xsl:variable>
418    <xsl:variable name="tmp">
419      <xsl:text>sprm:</xsl:text>
420      <xsl:value-of select="substring-after(@name, 'sprm')"/>
421    </xsl:variable>
422    <xsl:variable name="constname">
423      <xsl:call-template name="idtoqname">
424        <xsl:with-param name="id" select="$tmp"/>
425      </xsl:call-template>
426    </xsl:variable>
427    <xsl:text>
428sed "s/</xsl:text>
429    <xsl:value-of select="$lowerpattern"/>
430    <xsl:text>/</xsl:text>
431    <xsl:value-of select="$constname"/>
432    <xsl:text>/g" &lt; $1 > $1.out &amp;&amp; mv $1.out $1 </xsl:text>
433    <xsl:text>
434sed "s/</xsl:text>
435    <xsl:value-of select="$upperpattern"/>
436    <xsl:text>/</xsl:text>
437    <xsl:value-of select="$constname"/>
438    <xsl:text>/g" &lt; $1 > $1.out &amp;&amp; mv $1.out $1 </xsl:text>
439  </xsl:for-each>
440  <xsl:text>&#xa;</xsl:text>
441</xsl:template>
442
443<!-- Key all attributes with the same name and same value -->
444<xsl:key name="same-valued-tagged-data"
445         match="UML:TaggedValue.dataValue" use="." />
446
447<xsl:template name="analyzerdoctokidsattrs">
448  <xsl:text>
449  /* Attributes */</xsl:text>
450  <xsl:for-each select='.//UML:Attribute[@name!="reserved"]'>
451    <xsl:if test='count(.//UML:Stereotype[@xmi.idref="noqname"]) = 0'>
452      <xsl:for-each select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="attrid"]'>
453        <xsl:choose>
454          <xsl:when test='generate-id(UML:TaggedValue.dataValue) != generate-id(key("same-valued-tagged-data", UML:TaggedValue.dataValue)[1])'/>
455          <xsl:otherwise>
456            <xsl:text>
457    out &lt;&lt; "&lt;theid name=\"</xsl:text>
458    <xsl:value-of select=".//UML:TaggedValue.dataValue"/>
459    <xsl:text>\"&gt;</xsl:text>
460    <xsl:value-of select='10000 + position()'/>
461    <xsl:text>&lt;/theid&gt;" &lt;&lt; endl;</xsl:text>
462          </xsl:otherwise>
463        </xsl:choose>
464      </xsl:for-each>
465    </xsl:if>
466  </xsl:for-each>
467</xsl:template>
468
469<xsl:template name="analyzerdoctokidsops">
470  <xsl:text>
471  /* Operations */</xsl:text>
472  <xsl:for-each select='.//UML:Operation[@name!="reserved"]'>
473    <xsl:if test='count(.//UML:Stereotype[@xmi.idref="noqname"]) = 0'>
474      <xsl:for-each select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="opid"]'>
475        <xsl:choose>
476          <xsl:when test='generate-id(UML:TaggedValue.dataValue) != generate-id(key("same-valued-tagged-data", UML:TaggedValue.dataValue)[1])'/>
477          <xsl:otherwise>
478            <xsl:text>
479    out &lt;&lt; "&lt;theid name=\"</xsl:text>
480    <xsl:value-of select=".//UML:TaggedValue.dataValue"/>
481    <xsl:text>\"&gt;</xsl:text>
482    <xsl:value-of select='20000 + position()'/>
483    <xsl:text>&lt;/theid&gt;" &lt;&lt; endl;</xsl:text>
484          </xsl:otherwise>
485        </xsl:choose>
486      </xsl:for-each>
487    </xsl:if>
488  </xsl:for-each>
489</xsl:template>
490
491<xsl:template name="analyzerdoctokidsclasses">
492  <xsl:text>
493  /* clases */</xsl:text>
494  <xsl:for-each select='.//UML:Class[@name!="reserved"]'>
495    <xsl:for-each select='.//UML:TaggedValue[.//UML:TagDefinition/@xmi.idref="classid"]'>
496      <xsl:choose>
497        <xsl:when test='.//UML:Stereotype[@xmi.idref="noqname"]'/>
498        <xsl:when test='generate-id(UML:TaggedValue.dataValue) != generate-id(key("same-valued-tagged-data", UML:TaggedValue.dataValue)[1])'/>
499        <xsl:otherwise>
500          <xsl:text>
501    out &lt;&lt; "&lt;theid name=\"</xsl:text>
502    <xsl:value-of select=".//UML:TaggedValue.dataValue"/>
503    <xsl:text>\"&gt;</xsl:text>
504    <xsl:value-of select='30000 + position()'/>
505    <xsl:text>&lt;/theid&gt;" &lt;&lt; endl;</xsl:text>
506        </xsl:otherwise>
507      </xsl:choose>
508  </xsl:for-each>
509  </xsl:for-each>
510</xsl:template>
511
512<xsl:template match="UML:Model" mode="analyzerdoctokids">
513  <xsl:text>
514void doctokidsToXML(::std::ostream &amp; out)
515{</xsl:text>
516<xsl:call-template name="analyzerdoctokidsattrs"/>
517<xsl:call-template name="analyzerdoctokidsops"/>
518<xsl:call-template name="analyzerdoctokidsclasses"/>
519<xsl:text>
520}
521  </xsl:text>
522</xsl:template>
523
524  <xsl:template name="licenseheader">
525    <xsl:text>
526/*************************************************************
527 *
528 * Licensed to the Apache Software Foundation (ASF) under one
529 * or more contributor license agreements.  See the NOTICE file
530 * distributed with this work for additional information
531 * regarding copyright ownership.  The ASF licenses this file
532 * to you under the Apache License, Version 2.0 (the
533 * "License"); you may not use this file except in compliance
534 * with the License.  You may obtain a copy of the License at
535 *
536 *   http://www.apache.org/licenses/LICENSE-2.0
537 *
538 * Unless required by applicable law or agreed to in writing,
539 * software distributed under the License is distributed on an
540 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
541 * KIND, either express or implied.  See the License for the
542 * specific language governing permissions and limitations
543 * under the License.
544 *
545 *************************************************************/
546/*
547
548  THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT!
549
550*/
551&#xa;</xsl:text>
552  </xsl:template>
553</xsl:stylesheet>
554