/[volute]/trunk/projects/theory/snapdm/res/utype.xsl
ViewVC logotype

Contents of /trunk/projects/theory/snapdm/res/utype.xsl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 440 - (show annotations)
Sun May 11 06:09:48 2008 UTC (12 years, 6 months ago) by gerard.lemson
File MIME type: application/xml
File size: 3117 byte(s)
Updates regarding proper calculation of utypes and further refinements of TAP votables.
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE stylesheet [
4 <!ENTITY cr "<xsl:text>
5 </xsl:text>">
6 <!ENTITY bl "<xsl:text> </xsl:text>">
7 <!ENTITY dotsep "<xsl:text>.</xsl:text>">
8 <!ENTITY colonsep "<xsl:text>:</xsl:text>">
9 <!ENTITY slashsep "<xsl:text>/</xsl:text>">
10 ]>
11
12 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
13
14 <!--
15 Templates used by XSLT scripts to derive UTYPE-s for attributes, references and collections
16 -->
17
18
19
20 <xsl:template match="model" mode="utype">
21 <xsl:value-of select="name"/>
22 </xsl:template>
23
24
25
26
27 <xsl:template match="package" mode="utype">
28 <xsl:param name="prefix"/>
29 <xsl:choose>
30 <xsl:when test="prefix">
31 <xsl:value-of select="$prefix"/><xsl:value-of select="name"/>
32 </xsl:when>
33 <xsl:otherwise>
34 <xsl:variable name="sep">
35 <xsl:choose>
36 <xsl:when test="../name() = 'package'">&slashsep;</xsl:when>
37 <xsl:otherwise>&colonsep;</xsl:otherwise>
38 </xsl:choose>
39 </xsl:variable>
40 <xsl:apply-templates select=".." mode="utype"/><xsl:value-of select="$sep"/><xsl:value-of select="name"/>
41 </xsl:otherwise>
42 </xsl:choose> </xsl:template>
43
44
45
46 <xsl:template match="objectType" mode="utype">
47 <xsl:param name="prefix"/>
48 <xsl:choose>
49 <xsl:when test="prefix">
50 <xsl:value-of select="$prefix"/><xsl:value-of select="name"/>
51 </xsl:when>
52 <xsl:otherwise>
53 <xsl:apply-templates select=".." mode="utype"/>&slashsep;<xsl:value-of select="name"/>
54 </xsl:otherwise>
55 </xsl:choose>
56 </xsl:template>
57
58
59
60 <xsl:template match="dataType" mode="utype">
61 <xsl:text/>
62 </xsl:template>
63
64
65
66 <!-- this template assumes one can always select=".."
67 This breaks howevere for a node-set. Need an alternative solution there. -->
68 <xsl:template match="attribute" mode="utype">
69 <xsl:param name="prefix"/>
70
71 <xsl:variable name="utype">
72 <xsl:value-of select="$prefix"/>&dotsep;<xsl:value-of select="name"/>
73 </xsl:variable>
74
75 <xsl:variable name="type" select="key('element',datatype/@xmiidref)"/>
76 <xsl:choose>
77 <xsl:when test="$type/name() = 'primitiveType' or $type/name() = 'enumeration'">
78 <xsl:value-of select="$utype"/>
79 </xsl:when>
80 <xsl:otherwise>
81 <xsl:value-of select="$utype"/><br/>
82 <xsl:for-each select="$type/attribute">
83 <xsl:apply-templates select="." mode="utype">
84 <xsl:with-param name="prefix">
85 <xsl:value-of select="$utype"/>
86 </xsl:with-param>
87 </xsl:apply-templates><br/>
88 </xsl:for-each>
89 </xsl:otherwise>
90 </xsl:choose>
91 </xsl:template>
92
93
94
95
96 <xsl:template match="collection" mode="utype">
97 <xsl:apply-templates select=".." mode="utype"/><xsl:value-of select="name"/>
98 </xsl:template>
99
100
101
102 <xsl:template match="reference" mode="utype">
103 <xsl:apply-templates select=".." mode="utype"/><xsl:value-of select="name"/>
104 </xsl:template>
105
106
107 </xsl:stylesheet>

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26