title: How do you make an XSD element required or not required depending on the context?
body: <p>We have a definition of Person element where we want different elements to be required depending on 
  what they are doing.  For example, if they are adding a Person, then different elements are required
  to be sent versus updating a Person.  Below in the example, the Person type is currently duplicated, which
  of course is wrong.  Is there a good way of representing this in the xsd so we can reuse the Person type. </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:complexType name="Person"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;This is the definition when changing a person&lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
          &lt;xs:sequence&gt;
              &lt;xs:element name="PartyName" type="xs:string" minOccurs="0" maxOccurs="1"/&gt;
              &lt;xs:element name="GenderCode" type="GenderCode_Type" minOccurs="0" maxOccurs="1"/&gt;
              &lt;xs:element name="BirthDate" type="xs:date" minOccurs="0" maxOccurs="1"/&gt;
          &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
      &lt;xs:complexType name="Person"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;This is the definition when adding a person&lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
          &lt;xs:sequence&gt;
              &lt;xs:element name="PartyName" type="xs:string" minOccurs="1" maxOccurs="1"/&gt;
              &lt;xs:element name="GenderCode" type="GenderCode_Type" minOccurs="1" maxOccurs="1"/&gt;
              &lt;xs:element name="BirthDate" type="xs:date" minOccurs="0" maxOccurs="1"/&gt;
          &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;   
  &lt;/xs:schema&gt;
  </code></pre>