title: Create an XSD optional decimal element with restrictions
body: <p>I've managed to create an optional decimal element using this:</p>
  
  <pre><code>  &lt;xs:simpleType name="OptionalDecimal"&gt;
      &lt;xs:union memberTypes="xs:decimal empty-string" /&gt;
    &lt;/xs:simpleType&gt;
  </code></pre>
  
  <p>but I also need to add restrictions so that if it has been entered, to limit it to a maximum length of 10 and maximum number of 3 decimal places for example. So I've got this:</p>
  
  <pre><code>&lt;xs:restriction base="xs:decimal"&gt;
    &lt;xs:maxInclusive value="9999999999"/&gt;
    &lt;xs:fractionDigits value="3"/&gt;
  &lt;/xs:restriction&gt;
  </code></pre>
  
  <p>The problem is I don't know how to combine them. Can they be combined? Or is there a better way of doing this?</p>