title: What is the shortest Xpath I can write to select either an element or the child of a different element?
body: <p>I want to write an Xpath (1.0) where, with a common base element, it selects elements with different tag types and levels of depth. For example, I can use the following Xpath at the Google site:</p>
  
  <p><code>//*[@id='main']/span | //*[@id='main']/div/script</code></p>
  
  <p>...with the following HTML:</p>
  
  <pre><code>&lt;div id="main" class="content" data-jiis="cc"&gt;
      &lt;span id="body" class="ctr-p"&gt;
      &lt;div id="footer" class="ctr-p"&gt;
      &lt;div id="footc" data-jiis="uc" data-jibp="h"&gt;
          &lt;script&gt;
          &lt;div id="xfoot"&gt;...&lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Though I'd much prefer it as something along the lines of:</p>
  
  <p><code>//*[@id='main'](/span | /div/script)</code></p>
  
  <p>...which is an illegal expression. I tried some <code>self</code> stuff, but I can't figure out how to get it to grab the <code>script</code>, rather than the <code>div</code>:</p>
  
  <p><code>//*[@id='main']/*[self::span | self::div/script]</code></p>
  
  <p>I understand that <code>self::div/script</code> means to select a <code>div</code> with a <code>script</code> child, but I can't figure out the axis (if one exists) to select the <code>script</code> in this instance. How might I accomplish this? Or must I use the first Xpath I described?</p>