Named simpleType
with string restriction
and *pattern*
. This sT basicType is applied to multiple elements
. The catch is that two of these elements
require type change to base="xs:ID".
This can be done by creating unique sT's: one sT for the fields that utilize the basic *pattern* restriction
and another sT for the two fields requiring the ID base. Issue is that the pattern has to be duplicated in both sT declarations. It's a nit in my app but I wanted to learn if another approach was available. Specifically, one that would allow the pattern to be inherited and thus not duplicated for all the usual reasons. BTW: any alternative XSD 1.0 approach is OK. I'm not intending to restrict this to simpleType
solutions only.
What I'd like to do is have a single pattern sT that can be applied to non-ID fields and have another derived sT that adds the ID base for the fields requiring ID while inheriting the pattern of the other sT. Thus, pattern is defined and maintained in one place only.
FWIW, this is a MSXML6 Excel app.
The following code snippet shows that the pattern is duplicated in each of the sT's.
Q) How to streamline this process?
<xs:simpleType name="basicType">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z]([A-Z0-9;-]){1,8}">
<!-- Upper case A~Z followed by 1~8, upper-case alphanumerics including hyphen. No whitespace. -->
</xs:pattern>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="IDType">
<xs:restriction base="xs:ID">
<xs:pattern value="[A-Z]([A-Z0-9;-]){1,8}"/>
</xs:restriction>
</xs:simpleType>
- A
- B
`. – Meyer Jan 19 '17 at 16:23