Re: [xsl] Challenge: create xPath 2.0 regular expressions for each XML Schema datatype

Subject: Re: [xsl] Challenge: create xPath 2.0 regular expressions for each XML Schema datatype
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 18 Oct 2006 12:53:00 +0100
Most of those are already listed in the schema spec eg
http://www.w3.org/TR/xmlschema-2
lists:


 <xs:simpleType name="language" id="language">
    <xs:annotation>
      <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#language"/>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:pattern value="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"
                  id="language.pattern">
        <xs:annotation>

which fills in the value of language, pattern restrictions can easily be
converted to xpath2 regex, and constraints on the value space can use
xpath2 relations


so the fact that byte is

 <xs:simpleType name="byte" id="byte">
    <xs:annotation>
      <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#byte"/>
    </xs:annotation>
    <xs:restriction base="xs:short">
      <xs:minInclusive value="-128" id="byte.minInclusive"/>
      <xs:maxInclusive value="127" id="byte.maxInclusive"/>

tells you immediately that  the xpath2 for byte is

(:whatever you have for xs:short:) and $value >= -128 and $value <= 127

David

Current Thread