Changeset 4627 for metadata/trunk/toolkit/general-component-schema.xsd
- Timestamp:
- 03/06/14 10:23:25 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
metadata/trunk/toolkit/general-component-schema.xsd
r4525 r4627 256 256 <xs:annotation> 257 257 <xs:documentation>cardinality for elements and components</xs:documentation> 258 <xs:appinfo> 259 <sch:pattern id="c_card"> 260 <sch:title>Check cardinalities</sch:title> 261 <!-- 262 case minimum maximum check 263 1 UNK UNK OK 264 2 UNK number maximum ne 0 265 3 UNK unbounded OK 266 4 number UNK minimum le 1 267 5 number number minimum le maximum 268 6 number unbounded OK 269 7 unbounded UNK NOK 270 8 unbounded number NOK 271 9 unbounded unbounded OK 272 273 UNK can be either a missing attribute or an empty value, both can be detected with normalize-space(@...)='' 274 275 default CardinalityMin is 1 (based on the XSD minOccurs default value) 276 default CardinalityMax is 1 (based on the XSD maxOccurs default value) 277 278 If a basic XSLT 2.0 engine, like Saxon HE, is used for Schematron validation we can't cast to xs:nonNegativeInteger. 279 So we cast to xs:integer. The XSD validator should have already validated that the values are valid cardinality_types. 280 --> 281 <!-- skip case 1 --> 282 <!-- case 2 --> 283 <sch:rule context="*[(normalize-space(@CardinalityMin)='')][@CardinalityMax castable as xs:integer]"> 284 <sch:assert test="xs:integer(@CardinalityMax) ne 0">Maximum cardinality (0) cannot be lower than the default minimum cardinality (1)!</sch:assert> 285 </sch:rule> 286 <!-- skip case 3 --> 287 <!-- case 4 --> 288 <sch:rule context="*[@CardinalityMin castable as xs:integer][normalize-space(@CardinalityMax)='']"> 289 <sch:assert test="xs:integer(@CardinalityMin) le 1">Minimum cardinality (<sch:value-of select="@CardinalityMin"/>) should be lower or equal then the default maximum cardinality (1)!</sch:assert> 290 </sch:rule> 291 <!-- case 5 --> 292 <sch:rule context="*[@CardinalityMin castable as xs:integer][@CardinalityMax castable as xs:integer]"> 293 <sch:assert test="xs:integer(@CardinalityMin) le xs:integer(@CardinalityMax)">Minimum cardinality (<sch:value-of select="@CardinalityMin"/>) should be lower or equal then the maximum cardinality (<sch:value-of select="@CardinalityMax"/>)!</sch:assert> 294 </sch:rule> 295 <!-- skip case 6 --> 296 <!-- case 7, 8 and 9 --> 297 <sch:rule context="*[@CardinalityMin='unbounded']"> 298 <!-- case 7 and 8 --> 299 <sch:assert test="@CardinalityMax='unbounded'">Minimum cardinality (unbounded) can't be higher than the (default) maximum cardinality (<sch:value-of select="if (normalize-space(@CardinalityMax)='') then ('1') else (@CardinalityMax)"/>)!</sch:assert> 300 <!-- skip case 9 --> 301 </sch:rule> 302 </sch:pattern> 303 </xs:appinfo> 258 304 </xs:annotation> 259 305 <xs:union>
Note: See TracChangeset
for help on using the changeset viewer.