File: design2html.xsl

package info (click to toggle)
libxerces2-java 2.12.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 12,604 kB
  • sloc: java: 127,795; xml: 13,849; sh: 39; javascript: 18; makefile: 10
file content (231 lines) | stat: -rw-r--r-- 5,596 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<?xml version='1.0' encoding='US-ASCII'?>
<!-- $Id: design2html.xsl 317483 2001-08-23 00:35:39Z lehors $ -->
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

 <xsl:template match='design'>
  <HTML>
   <HEAD>
    <TITLE>Xerces 2 | Design</TITLE>
    <STYLE type='text/css'>
     .class { background: #DDDDFF }
     .class-title { font: bold }
     .interface { background: #FFDDDD }
     .interface-title { font: italic }
     .extends { }
     .implements { }
     .constants { }
     .constant-title { }
     .fields { }
     .field-title { }
     .constructors { }
     .constructor-title { text-decoration: underline }
     .methods { }
     .method-title { text-decoration: underline }
     .param-title { }
    </STYLE>
   </HEAD>
   <BODY>
    <H1 align='center'>
     <xsl:value-of select='@name'/>
     <xsl:text> </xsl:text>
     Design
    </H1>
    <H2>Classes and Interfaces</H2>
    <xsl:for-each select='category'>
     <xsl:apply-templates select='.'/>
    </xsl:for-each>
    Last modified: <xsl:value-of select='@date'/>
   </BODY>
  </HTML>
 </xsl:template>

 <xsl:template match='category'>
  <H3><xsl:value-of select='@name'/></H3>
  <xsl:for-each select='class|interface'>
   <BLOCKQUOTE>
    <xsl:apply-templates select='.'/>
   </BLOCKQUOTE>
  </xsl:for-each>
 </xsl:template>

 <xsl:template match='class|interface'>
  <A name='{@name}'>
  <DL class='{name()}'>
   <DT>
    <xsl:value-of select='name()'/>
    <xsl:text> </xsl:text>
    <SPAN class='{name()}-title'>
     <xsl:value-of select='@name'/>
    </SPAN>
   </DT>
   <xsl:if test='extends'>
    <DD class='extends'>
     extends
     <xsl:for-each select='extends'>
      <xsl:call-template name='type'/>
     </xsl:for-each>
    </DD>
   </xsl:if>
   <xsl:if test='implements'>
    <DD class='implements'>
     implements
     <xsl:for-each select='implements'>
      <xsl:call-template name='type'/>
      <xsl:if test='not(position()=last())'>
       <xsl:text>, </xsl:text>
      </xsl:if>
     </xsl:for-each>
    </DD>
   </xsl:if>
   <xsl:if test='constant'>
    <DD class='constants'>
     constants:
     <UL>
      <xsl:for-each select='constant'>
       <LI>
        <xsl:apply-templates select='.'/>
       </LI>
      </xsl:for-each>
     </UL>
    </DD>
   </xsl:if>
   <xsl:if test='field'>
    <DD class='fields'>
     fields:
     <UL>
      <xsl:for-each select='field'>
       <LI>
        <xsl:apply-templates select='.'/>
       </LI>
      </xsl:for-each>
     </UL>
    </DD>
   </xsl:if>
   <xsl:if test='constructor'>
    <DD class='constructors'>
     constructors:
     <UL>
      <xsl:for-each select='constructor'>
       <LI>
        <xsl:apply-templates select='.'/>
       </LI>
      </xsl:for-each>
     </UL>
    </DD>
   </xsl:if>
   <xsl:if test='method'>
    <DD class='methods'>
     methods:
     <UL>
      <xsl:for-each select='method'>
       <LI>
        <xsl:apply-templates select='.'/>
       </LI>
      </xsl:for-each>
     </UL>
    </DD>
   </xsl:if>
  </DL>
  </A>
 </xsl:template>

 <xsl:template match='constant|field|param'>
  <!--
  <xsl:if test='not(name()="param") and not(@visibility="public")'>
   <IMG alt='' src='{@visibility}.gif'/>
  </xsl:if>
  -->
  <xsl:call-template name='type'/>
  <xsl:text> </xsl:text>
  <SPAN class='{name()}-title'>
   <xsl:value-of select='@name'/>
  </SPAN>
 </xsl:template>

 <xsl:template match='constructor'>
  <!--
  <xsl:if test='not(@visibility="public")'>
   <IMG alt='' src='{@visibility}.gif'/>
  </xsl:if>
  -->
  <SPAN class='constructor-title'>
   <xsl:value-of select='../@name'/>
  </SPAN>
  (
  <xsl:for-each select='param'>
   <xsl:apply-templates select='.'/>
   <xsl:if test='not(position()=last())'>
    <xsl:text>, </xsl:text>
   </xsl:if>
  </xsl:for-each>
  )
 </xsl:template>

 <xsl:template match='method'>
  <!--
  <xsl:if test='not(@visibility="public")'>
   <IMG alt='' src='{@visibility}.gif'/>
  </xsl:if>
  -->
  <SPAN class='method-title'>
   <xsl:value-of select='@name'/>
  </SPAN>
  (
  <xsl:for-each select='param'>
   <xsl:apply-templates select='.'/>
   <xsl:if test='not(position()=last())'>
    <xsl:text>, </xsl:text>
   </xsl:if>
  </xsl:for-each>
  )
  <xsl:for-each select='returns'>
   :
   <xsl:call-template name='type'/>
  </xsl:for-each>
 </xsl:template>

 <xsl:template name='type'>
  <xsl:apply-templates select='array|primitive|reference|collection'/>
 </xsl:template>

 <xsl:template match='array'>
  <xsl:call-template name='type'/>[]
 </xsl:template>

 <xsl:template match='primitive'>
  <xsl:value-of select='@type'/>
 </xsl:template>

 <xsl:template match='union'>
  <xsl:for-each select='part'>
   <xsl:apply-templates select='.'/>
  </xsl:for-each>
 </xsl:template>

 <xsl:template match='reference'>
  <xsl:choose>
   <xsl:when test='id(@idref)[name()="interface"]'>
    <SPAN class='interface-title'>
     <xsl:value-of select='id(@idref)/@name'/>
    </SPAN>
   </xsl:when>
   <xsl:otherwise>
    <SPAN class='class-title'>
     <xsl:value-of select='id(@idref)/@name'/>
    </SPAN>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>

 <xsl:template match='collection'>
  <xsl:for-each select='collector'>
   <xsl:call-template name='type'/>
  </xsl:for-each>
  &lt;
  <xsl:for-each select='items'>
   <xsl:call-template name='type'/>
  </xsl:for-each>
  &gt;
 </xsl:template>

</xsl:stylesheet>