Revision 1660
Added by Jing Tao over 21 years ago
eml-constraint-2.0.0.xsl | ||
---|---|---|
30 | 30 |
* suitable for rendering with modern web browsers. |
31 | 31 |
--> |
32 | 32 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
33 |
<xsl:import href="eml-settings-2.0.0beta6-@name@.xsl" /> |
|
34 |
<xsl:import href="eml-identifier-2.0.0beta6-@name@.xsl" /> |
|
35 |
|
|
36 | 33 |
<xsl:output method="html" encoding="iso-8859-1"/> |
37 |
|
|
38 |
|
|
39 |
<xsl:template match="/"> |
|
40 |
<html> |
|
41 |
<head> |
|
42 |
<link rel="stylesheet" type="text/css" |
|
43 |
href="{$stylePath}/{$qformat}.css" /> |
|
44 |
</head> |
|
45 |
<body> |
|
46 |
<center> |
|
47 |
<h1>Constraints</h1> |
|
48 |
<h3>Ecological Metadata Language</h3> |
|
49 |
</center> |
|
50 |
<table class="tabledefault" width="100%"><!-- width needed for NN4 - doesn't recognize width in css --> |
|
51 |
<xsl:apply-templates select="eml-constraint/identifier" mode="resource"/> |
|
52 |
<xsl:for-each select="eml-constraint/constraint"> |
|
53 |
<tr><td class="{$subHeaderStyle}" colspan="2"> |
|
54 |
<xsl:text>Relational Integrity Constraints:</xsl:text></td></tr> |
|
55 |
<xsl:apply-templates select="."/> |
|
56 |
</xsl:for-each> |
|
57 |
|
|
58 |
</table> |
|
59 |
</body> |
|
60 |
</html> |
|
34 |
|
|
35 |
<!-- This module is for constraint. And it is self contained--> |
|
36 |
<xsl:template name="constraint"> |
|
37 |
<xsl:param name="constraintfirstColStyle"/> |
|
38 |
<table class="tabledefault" width="100%"> |
|
39 |
<xsl:choose> |
|
40 |
<xsl:when test="references!=''"> |
|
41 |
<xsl:variable name="ref_id" select="references"/> |
|
42 |
<xsl:variable name="references" select="$ids[@id=$ref_id]" /> |
|
43 |
<xsl:for-each select="$references"> |
|
44 |
<xsl:call-template name="constraintCommon"> |
|
45 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
46 |
</xsl:call-template> |
|
47 |
</xsl:for-each> |
|
48 |
</xsl:when> |
|
49 |
<xsl:otherwise> |
|
50 |
<xsl:call-template name="constraintCommon"> |
|
51 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
52 |
</xsl:call-template> |
|
53 |
</xsl:otherwise> |
|
54 |
</xsl:choose> |
|
55 |
</table> |
|
61 | 56 |
</xsl:template> |
57 |
|
|
58 |
<xsl:template name="constraintCommon"> |
|
59 |
<xsl:param name="constraintfirstColStyle"/> |
|
60 |
<xsl:for-each select="primaryKey"> |
|
61 |
<xsl:call-template name="primaryKey"> |
|
62 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
63 |
</xsl:call-template> |
|
64 |
</xsl:for-each> |
|
65 |
<xsl:for-each select="uniqueKey"> |
|
66 |
<xsl:call-template name="uniqueKey"> |
|
67 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
68 |
</xsl:call-template> |
|
69 |
</xsl:for-each> |
|
70 |
<xsl:for-each select="checkConstraint"> |
|
71 |
<xsl:call-template name="checkConstraint"> |
|
72 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
73 |
</xsl:call-template> |
|
74 |
</xsl:for-each> |
|
75 |
<xsl:for-each select="foreignKey"> |
|
76 |
<xsl:call-template name="foreignKey"> |
|
77 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
78 |
</xsl:call-template> |
|
79 |
</xsl:for-each> |
|
80 |
<xsl:for-each select="joinCondition"> |
|
81 |
<xsl:call-template name="joinCondition"> |
|
82 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
83 |
</xsl:call-template> |
|
84 |
</xsl:for-each> |
|
85 |
<xsl:for-each select="notNullConstraint"> |
|
86 |
<xsl:call-template name="notNullConstraint"> |
|
87 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
88 |
</xsl:call-template> |
|
89 |
</xsl:for-each> |
|
90 |
</xsl:template> |
|
91 |
|
|
92 |
<!--Keys part--> |
|
93 |
<xsl:template name="primaryKey"> |
|
94 |
<xsl:param name="constraintfirstColStyle"/> |
|
95 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
96 |
<xsl:text>Type</xsl:text></td> |
|
97 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
98 |
Primary Key</td> |
|
99 |
</tr> |
|
100 |
<xsl:call-template name="constraintBaseGroup"> |
|
101 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
102 |
</xsl:call-template> |
|
103 |
<xsl:for-each select="key/attributeReference"> |
|
104 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
105 |
<xsl:text>Key</xsl:text></td> |
|
106 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
107 |
<xsl:value-of select="."/></td> |
|
108 |
</tr> |
|
109 |
</xsl:for-each> |
|
110 |
</xsl:template> |
|
111 |
|
|
112 |
<xsl:template name="uniqueKey"> |
|
113 |
<xsl:param name="constraintfirstColStyle"/> |
|
114 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
115 |
<xsl:text>Type</xsl:text></td> |
|
116 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
117 |
Unique Key</td> |
|
118 |
</tr> |
|
119 |
<xsl:call-template name="constraintBaseGroup"> |
|
120 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
121 |
</xsl:call-template> |
|
122 |
<xsl:for-each select="key/attributeReference"> |
|
123 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
124 |
<xsl:text>Key</xsl:text></td> |
|
125 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
126 |
<xsl:value-of select="."/></td> |
|
127 |
</tr> |
|
128 |
</xsl:for-each> |
|
129 |
</xsl:template> |
|
130 |
|
|
131 |
<xsl:template name="checkConstraint"> |
|
132 |
<xsl:param name="constraintfirstColStyle"/> |
|
133 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
134 |
<xsl:text>Type</xsl:text></td> |
|
135 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
136 |
Checking Constraint</td> |
|
137 |
</tr> |
|
138 |
<xsl:call-template name="constraintBaseGroup"> |
|
139 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
140 |
</xsl:call-template> |
|
141 |
<xsl:for-each select="checkCondition"> |
|
142 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
143 |
<xsl:text>Check Condition</xsl:text></td> |
|
144 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
145 |
<xsl:value-of select="."/></td> |
|
146 |
</tr> |
|
147 |
</xsl:for-each> |
|
148 |
</xsl:template> |
|
149 |
|
|
150 |
<xsl:template name="foreignKey"> |
|
151 |
<xsl:param name="constraintfirstColStyle"/> |
|
152 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
153 |
<xsl:text>Type</xsl:text></td> |
|
154 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
155 |
Foreign Key</td> |
|
156 |
</tr> |
|
157 |
<xsl:call-template name="constraintBaseGroup"> |
|
158 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
159 |
</xsl:call-template> |
|
160 |
<xsl:for-each select="key/attributeReference"> |
|
161 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
162 |
<xsl:text>Key</xsl:text></td> |
|
163 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
164 |
<xsl:value-of select="."/></td> |
|
165 |
</tr> |
|
166 |
</xsl:for-each> |
|
167 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
168 |
<xsl:text>Entity Reference</xsl:text></td> |
|
169 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
170 |
<xsl:value-of select="entityReference"/></td> |
|
171 |
</tr> |
|
172 |
<xsl:if test="relationshipType and normalize-space(relationshipType)!=''"> |
|
173 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
174 |
<xsl:text>Relation Ship</xsl:text></td> |
|
175 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
176 |
<xsl:value-of select="relationshipType"/></td> |
|
177 |
</tr> |
|
178 |
</xsl:if> |
|
179 |
<xsl:if test="cardinality and normalize-space(cardinality)!=''"> |
|
180 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
181 |
<xsl:text>Cardinality</xsl:text></td> |
|
182 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
183 |
 </td> |
|
184 |
</tr> |
|
185 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
186 |
 </td> |
|
187 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
188 |
<table width="100%"> |
|
189 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
190 |
<xsl:text>Parent</xsl:text></td> |
|
191 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
192 |
<xsl:value-of select="cardinality/parentOccurences"/></td> |
|
193 |
</tr> |
|
194 |
</table> |
|
195 |
</td> |
|
196 |
</tr> |
|
197 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
198 |
 </td> |
|
199 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
200 |
<table width="100%"> |
|
201 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
202 |
<xsl:text>Children</xsl:text></td> |
|
203 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
204 |
<xsl:value-of select="cardinality/childOccurences"/></td> |
|
205 |
</tr> |
|
206 |
</table> |
|
207 |
</td> |
|
208 |
</tr> |
|
209 |
</xsl:if> |
|
210 |
</xsl:template> |
|
211 |
|
|
212 |
<xsl:template name="joinCondition"> |
|
213 |
<xsl:param name="constraintfirstColStyle"/> |
|
214 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
215 |
<xsl:text>Type</xsl:text></td> |
|
216 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
217 |
Join Condition</td> |
|
218 |
</tr> |
|
219 |
<xsl:call-template name="foreignKey"> |
|
220 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
221 |
</xsl:call-template> |
|
222 |
<xsl:for-each select="referencedKey/attributeReference"> |
|
223 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
224 |
<xsl:text>Referenced Key</xsl:text></td> |
|
225 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
226 |
<xsl:value-of select="."/></td> |
|
227 |
</tr> |
|
228 |
</xsl:for-each> |
|
229 |
</xsl:template> |
|
230 |
|
|
231 |
<xsl:template name="notNullConstraint"> |
|
232 |
<xsl:param name="constraintfirstColStyle"/> |
|
233 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
234 |
<xsl:text>Type</xsl:text></td> |
|
235 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
236 |
Not Null Constraint</td> |
|
237 |
</tr> |
|
238 |
<xsl:call-template name="constraintBaseGroup"> |
|
239 |
<xsl:with-param name="constraintfirstColStyle" select="$constraintfirstColStyle"/> |
|
240 |
</xsl:call-template> |
|
241 |
<xsl:for-each select="key/attributeReference"> |
|
242 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
243 |
<xsl:text>Key</xsl:text></td> |
|
244 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
245 |
<xsl:value-of select="."/></td> |
|
246 |
</tr> |
|
247 |
</xsl:for-each> |
|
248 |
</xsl:template> |
|
249 |
|
|
250 |
<xsl:template name="constraintBaseGroup"> |
|
251 |
<xsl:param name="constraintfirstColStyle"/> |
|
252 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
253 |
<xsl:text>Constraint Name</xsl:text></td> |
|
254 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
255 |
<xsl:value-of select="constraintName"/></td> |
|
256 |
</tr> |
|
257 |
<xsl:if test="constraintDescription and normalize-space(constraintDescription)!=''"> |
|
258 |
<tr><td width="{$firstColWidth}" class="{$constraintfirstColStyle}"> |
|
259 |
<xsl:text>Description</xsl:text></td> |
|
260 |
<td width="{$secondColWidth}" class="{$secondColStyle}"> |
|
261 |
<xsl:value-of select="constraintDescription"/></td> |
|
262 |
</tr> |
|
263 |
</xsl:if> |
|
264 |
</xsl:template> |
|
265 |
|
|
62 | 266 |
|
63 |
|
|
64 | 267 |
<xsl:template match="constraint"> |
65 | 268 |
<xsl:if test="normalize-space(constraintType)!=''"> |
66 | 269 |
<tr><td width="{$firstColWidth}" class="{$firstColStyle}"> |
Also available in: Unified diff
Finished the module.