- From: Mukul Gandhi <gandhi.mukul@gmail.com>
- Date: Fri, 25 Feb 2011 12:52:49 +0530
- To: "Costello, Roger L." <costello@mitre.org>
- Cc: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Hi Roger,
This seems to be possible with XML Schema 1.1 assertions. Here's an
example please,
<xs:simpleType name="Person-name">
<xs:restriction base="xs:string">
<xs:assertion test="(string-length(tokenize($value,'\s')[1]) =
(1 to 100)) and matches(tokenize($value,'\s')[1], 'REG-EX_1')" />
<xs:assertion test="(string-length(tokenize($value,'\s')[2]) =
1) and matches(tokenize($value,'\s')[2], 'REG-EX_2')" />
<xs:assertion test="(string-length(tokenize($value,'\s')[3]) =
(1 to 100)) and matches(tokenize($value,'\s')[3], 'REG-EX_3')" />
</xs:restriction>
</xs:simpleType>
On Thu, Feb 24, 2011 at 4:19 PM, Costello, Roger L. <costello@mitre.org> wrote:
> Hi Folks,
>
> Suppose this is the value space for "family name" values:
>
> length: 1 - 100 characters
> consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe
>
> That value space is implemented using this simpleType:
>
> <xs:simpleType name="Family-name">
> <xs:restriction base="xs:string">
> <xs:minLength value="1" />
> <xs:maxLength value="100" />
> <xs:pattern value="[a-zA-Z' \.-]+" />
> </xs:restriction>
> </xs:simpleType>
>
>
> Suppose this is the value space for "middle initial" values:
>
> length: 1 character
> consists of the characters: A-Z
>
> That value space is implemented using this simpleType:
>
> <xs:simpleType name="Middle-initial">
> <xs:restriction base="xs:string">
> <xs:length value="1" />
> <xs:pattern value="[A-Z]+" />
> </xs:restriction>
> </xs:simpleType>
>
>
> Suppose this is the value space for "given name" values:
>
> length: 1 - 100 characters
> consists of the characters: a-z, A-Z, space, hyphen, period, and apostrophe
>
> That value space is implemented using this simpleType:
>
> <xs:simpleType name="Given-name">
> <xs:restriction base="xs:string">
> <xs:minLength value="1" />
> <xs:maxLength value="100" />
> <xs:pattern value="[a-zA-Z' \.-]+" />
> </xs:restriction>
> </xs:simpleType>
>
>
> Now there are 3 user-defined value spaces. Let me denote them by F, M, G, respectively. (F = Family, M = Middle, G = Given)
>
> I would like to aggregate them to create a "person name" value space. This is the value space for person name:
>
> Person-name is the cross product: G x M x F
>
> Here is an example of a value in the Person-name value space:
>
> ("Roger", "L", "Costello")
>
> How do I implement the Person-name value space?
>
> /Roger
--
Regards,
Mukul Gandhi
Received on Friday, 25 February 2011 07:23:41 UTC