xsd:restriction

Purpose

Allows page authors to imposes restrictions on the data type specified by the base attribute. Restrictions can be nested. Refer to the topic entitled Specifying data types and validation criteria for more information.

Contained by

Contains

Attributes

Attribute Description Type Default Options Use
base The type of the data item. xs:QName   mcs:tel, xforms:anyURI, xforms:date, xforms:dateTime, xforms:decimal, xforms:double, xforms:email, xforms:float, xforms:string, xforms:time, <custom_type> optional 

Example

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:si="http://www.volantis.com/xmlns/2006/01/xdime2/si"
  xmlns:xforms="http://www.w3.org/2002/xforms"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <head>
    <title>xsd:maxInclusive</title>
    <xforms:model id="model1">
      <xsd:schema>
        <xsd:simpleType name="myType">
          <xsd:restriction base="otherMyType">
            <xsd:maxInclusive value="51"/>
          </xsd:restriction>
        </xsd:simpleType>
        <xsd:simpleType name="otherMyType">
          <xsd:restriction base="xforms:float">
            <xsd:maxInclusive value="512"/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:schema>
      <xforms:instance>
        <si:instance>
          <si:item name="number"/>
        </si:instance>
      </xforms:instance>
      <xforms:bind nodeset="number" type="myType"/>
    </xforms:model>
  </head>
  <body>
    <xforms:input model="model1" ref="number">
      <xforms:label>Pick a number:</xforms:label>
    </xforms:input>
  </body>
</html>

Related topics