title: Using xpath on PHP: how to select first child?
body: <p>I have an XML structure like this one:</p>
  <pre><code>&lt;layout&gt;
      &lt;pattern&gt; ... &lt;/pattern&gt;
      &lt;row&gt; ... &lt;/row&gt;
  &lt;/layout&gt;
  </code></pre>
  <p>How can I select the first node of <code>&lt;layout&gt;</code> by its index, using XPath?</p>
  <p>w3schools indicates syntax similar to <code>/bookstore/book[1]/title </code>, but then <a href="http://www.w3schools.com/xsl/xpath_examples.asp" rel="nofollow noreferrer">says</a>:</p>
  <blockquote>
  <p>There is a problem with this. The example above shows different results in IE and other browsers.</p>
  <p>IE5 and later has implemented that [0] should be the first node, but according to the W3C standard it should have been [1]!!</p>
  <p>A Workaround!<br />
  To solve the [0] and [1] problem in IE5+, you can set the SelectionLanguage to XPath.</p>
  </blockquote>
  <p>But that's client-specific. The PHP manual isn't very clear about this either.</p>