title: XSD: A <xs:choice> equivalent for attributes
body: <p>I wish to create an XML document in which one of its elements must be defined with one of two known attributes, but not both.</p>
  
  <p>For example, I would like to define a "webAddress" element as follows:</p>
  
  <pre><code> &lt;xs:element name="webAddress"&gt;
       &lt;xs:complexType&gt;
           &lt;xs:attribute name="hostName" type="xs:string"/&gt;
           &lt;xs:attribute name="hostAddress" type="xs:string"/&gt;
       &lt;/xs:complexType&gt;
   &lt;/xs:element&gt;
  </code></pre>
  
  <p>but I only want a user to be able to define either a hostName attribute (e.g., hostName= ") or a hostAddress (e.g., hostAddress="") attribute, but not both.  It appears that the  construct accomplishes this for elements.  Is there a functional equivalent for attributes, or is there a better way to approach this?</p>
  
  <p>If found that we can't do this with W3C XML Schema.
  We can use an embedded schematron rule but can we do it on choice element by checking element and attribute together?
  For example something like this:</p>
  
  <pre><code>&lt;xs:choice&gt;
       &lt;xs:element name="webAddress"&gt;
           &lt;xs:complexType&gt;
               &lt;xs:attribute name="hostName" type="xs:string"/&gt;
           &lt;/xs:complexType&gt;
       &lt;/xs:element&gt;
       &lt;xs:element name="webAddress"&gt;
           &lt;xs:complexType&gt;
               &lt;xs:attribute name="hostAddress" type="xs:string"/&gt;
           &lt;/xs:complexType&gt;
       &lt;/xs:element&gt;
    &lt;/xs:choice&gt;
  </code></pre>