xsl-list
[Top] [All Lists]

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

2006-10-18 04:53:15


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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--