title: Assertion contains for XSD
body: <p>I want to create a conditional validation for XML with a XSD. I want if the element Unit is "uri" then the element Value must contains "http", else if element Unit is "date" then the element Value must be a timestamp, and so on... I am starting with a simple validation using xs:assert and is not working. I already tested xs:assertion but it produced the same error.</p>
  
  <pre><code>xmllint --noout --schema metadata.xsd metadata.xml 
  metadata.xsd:46: element assert: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}complexType': The content is not valid. Expected is (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))).
  WXS schema metadata.xsd failed to compile
  </code></pre>
  
  <p>.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
   &lt;xs:element name="metadata"&gt;
    &lt;xs:complexType&gt;
     &lt;xs:sequence&gt;
      &lt;xs:element name="AVU" minOccurs="0" maxOccurs="unbounded"&gt;
       &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
  
         &lt;xs:element name="Target" minOccurs="0"&gt;
          &lt;xs:simpleType&gt;
           &lt;xs:restriction base="xs:string"&gt;
            &lt;xs:maxLength value="1088"/&gt;
           &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
         &lt;/xs:element&gt;
  
         &lt;xs:element name="Attribute"&gt;
          &lt;xs:simpleType&gt;
           &lt;xs:restriction base="xs:string"&gt;
            &lt;xs:minLength value="1"/&gt;
            &lt;xs:maxLength value="2700"/&gt;
           &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
         &lt;/xs:element&gt;
  
         &lt;xs:element name="Value"&gt;
          &lt;xs:simpleType&gt;
           &lt;xs:restriction base="xs:string"&gt;
            &lt;xs:pattern value="http://.*"/&gt;
            &lt;xs:maxLength value="2700"/&gt;
           &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
         &lt;/xs:element&gt;
  
         &lt;xs:element name="Unit"&gt;
          &lt;xs:simpleType&gt;
           &lt;xs:restriction base="xs:string"&gt;
            &lt;xs:pattern value="uri|string|integer|date|float"/&gt;
            &lt;xs:maxLength value="250"/&gt;
           &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
         &lt;/xs:element&gt;
  
        &lt;/xs:sequence&gt;
        &lt;xs:assert test="Unit = 'uri'" /&gt;
       &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
     &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
   &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>