XForms/Validate with schema types

Motivation.
You would like to use a library of XML Schema simple types with restrictions to validate your form.
Notice.
Most type validation with the exception of the most simple types does not currently work under the FireFox extension.
Sample Program sample.xhtml.
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;html
 xmlns="http://www.w3.org/1999/xhtml"
 xmlns:xf="http://www.w3.org/2002/xforms"
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:ftype="http://www.example.com/my-file-types"&gt;
 &lt;head&gt;
 &lt;title&gt;Validate Postal Codes&lt;/title&gt;
 &lt;style type="text/css"&gt;
 @namespace xf url("http://www.w3.org/2002/xforms");
 xf|input {
 display: table-row;
 line-height: 2em;
 xf|label {
 display: table-cell;
 text-align: right;
 font-family: Arial, Helvetica, sans-serif;;
 font-weight: bold;
 padding-right: 5px;
 width: 150px;
 *:required {
 background-color: yellow;
 *:invalid {
 background-color: pink;
 &lt;/style&gt;
 &lt;xf:model schema="schema.xsd"&gt;
 &lt;xf:instance src="instance.xml" /&gt;
 &lt;xf:bind id="zip" required="true()" type="ftype:zipType" nodeset="ftype:zip" /&gt;
 &lt;xf:bind id="zip2" required="true()" type="ftype:zip2Type" nodeset="ftype:zip2" /&gt;
 &lt;/xf:model&gt;
 &lt;/head&gt;
 &lt;body&gt;
 &lt;xf:input bind="zip" incremental="true"&gt;
 &lt;xf:label&gt;Zip Code: &lt;/xf:label&gt;
 &lt;xf:hint&gt;Validation is not correctly specified for this field&lt;/xf:hint&gt;
 &lt;xf:alert&gt;The 'Zip Code' failed to validate!&lt;/xf:alert&gt;
 &lt;/xf:input&gt;
 &lt;xf:input bind="zip2" incremental="true"&gt;
 &lt;xf:label&gt;Zip Code 2: &lt;/xf:label&gt;
 &lt;xf:hint&gt;Validation is correctly specified for this field&lt;/xf:hint&gt;
 &lt;xf:alert&gt;
 &lt;xf:output value="concat('The &amp;amp;quot;', name(), '&amp;amp;quot; failed to validate!')" /&gt;
 &lt;/xf:alert&gt;
 &lt;/xf:input&gt;
 &lt;/body&gt;
&lt;/html&gt;
Example XML Schema File schema.xsd.
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xs:schema
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:ftype="http://www.example.com/my-file-types"
 targetNamespace="http://www.example.com/my-file-types"
 elementFormDefault="qualified" attributeFormDefault="unqualified"&gt;
 &lt;xs:element name="data"&gt;
 &lt;xs:annotation&gt;
 &lt;xs:documentation&gt;Test XML Schema&lt;/xs:documentation&gt;
 &lt;/xs:annotation&gt;
 &lt;xs:complexType&gt;
 &lt;xs:sequence&gt;
 &lt;xs:element name="zip" type="ftype:zipType"/&gt;
 &lt;/xs:sequence&gt;
 &lt;/xs:complexType&gt;
 &lt;/xs:element&gt;
 &lt;xs:simpleType name="zipType"&gt;
 &lt;xs:restriction base="xs:string"&gt;
 &lt;!-- bad pattern: matches any sequence of 5 digits, even if there are more digits or non-numeric. --&gt;
 &lt;xs:pattern value="\d{5}"/&gt;
 &lt;/xs:restriction&gt;
 &lt;/xs:simpleType&gt;
 &lt;xs:simpleType name="zip2Type"&gt;
 &lt;xs:restriction base="xs:string"&gt;
 &lt;!-- good pattern: matches only 5 digits, nothing extra --&gt;
 &lt;xs:pattern value="^\d{5}$"/&gt;
 &lt;/xs:restriction&gt;
 &lt;/xs:simpleType&gt;
&lt;/xs:schema&gt;
Sample instance document instance.xml.
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;data xmlns="http://www.example.com/my-file-types"&gt;
 &lt;zip&gt;12345&lt;/zip&gt;
 &lt;zip2&gt;12345&lt;/zip2&gt;
&lt;/data&gt;