title: Phantom <span> element using ImportXML with XPath in Google Spreadsheet
body: <p>I am trying to get the value of an element attribute from <a href="http://www.marketonline.ro/placi-de-baza/placa-de-baza-gigabyte-ga-z87x-ud3h-socket-1150-chipset-z87-atx-haswell" rel="nofollow">this site</a> via importXML in Google Spreadsheet using XPath.</p>
  
  <p>The attribute value i seek is <code>content</code> found in the <code>&lt;span&gt;</code> with <code>itemprop="price"</code>.</p>
  
  <pre><code>&lt;div class="left" style="margin-top: 10px;"&gt;
      &lt;meta itemprop="currency" content="RON"&gt;
          &lt;span class="pret" itemprop="price" content="698,31 RON"&gt;
              &lt;p class="pret"&gt;Pretul tau:&lt;/p&gt;
              698,31 RON
          &lt;/span&gt;
  ...
  &lt;/div&gt;
  </code></pre>
  
  <p>I can access <code>&lt;div class="left"&gt;</code> but i can't get to the <code>&lt;span&gt;</code> element.</p>
  
  <p><strong>Tried using:</strong></p>
  
  <ul>
  <li><code>//span[@class='pret']/@content</code> i get #N/A;</li>
  <li><code>//span[@itemprop='price']/@content</code> i get #N/A;</li>
  <li><code>//div[@class='left']/span[@class='pret' and @itemprop='price']/@content</code> i get #N/A;</li>
  <li><code>//div[@class='left']/span[1]/@content</code> i get #N/A;</li>
  <li><code>//div[@class='left']/span/text()</code> to get the text node of <code>&lt;span&gt;</code> i get #N/A;</li>
  <li><code>//div[@class='left']</code><strong><code>//</code></strong><code>span/text()</code> i get the text node of a <code>&lt;span&gt;</code> lower in <code>div.left</code>.</li>
  </ul>
  
  <p>To get the text node of <code>&lt;span&gt;</code> i have to use <code>//div[@class='left']/text()</code>. But i can't use that text node because the layout of the span changes if a product is on sale, so i need the attribute.</p>
  
  <p>It's like the span i'm looking for does not exist, although it appears in the development view of Chrome and in the page source and all XPath work in the console using <code>$x("")</code>.</p>
  
  <p>I tried to generate the XPath directly form the development tool by right clicking and i get <code>//*[@id='produs']/div[4]/div[4]/div[1]/span</code> which does not work. I also tried to generate the XPath with Firefox and plugins for FF and Chrome to no avail. The XPath generated in these ways did not even work on sites i managed to scrape with "hand coded XPath".</p>
  
  <p><strong>Now, the strangest thing is that on this <a href="http://www.emag.ro/placa-de-baza-gigabyte-socket-1150-z87x-ud3h/pd/EZCB0BBBM/" rel="nofollow">other site</a> with apparently similar code structure the XPath <code>//span[@itemprop='price']/@content</code> works.</strong></p>
  
  <p>I struggled with this for 4 days now. I'm starting to think it's something to do with the auto-closing meta tag, but why doesn't this happen on the other site?</p>