Selenium, Java. Need to select ancestor element inside table by Xpath
<p>I have an HTML page containing the following code :  </p>

<pre><code>&lt;table class="report" style="width:100%"&gt;
   &lt;tbody&gt;
      &lt;tr&gt;
         &lt;th/&gt;
         &lt;th&gt;Position Open
            &lt;br&gt;
            &lt;span class="timestamp"&gt;27/7/2016 16:12:12&lt;/span&gt;
            &lt;/br&gt;
         &lt;/th&gt;
         &lt;th&gt;Position closed
            &lt;br&gt;
            &lt;span class="timestamp"&gt;27/7/2016 16:12:42&lt;/span&gt;
            &lt;/br&gt;
         &lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
         &lt;td&gt;
            &lt;span dir="ltr"&gt;EURJPY&lt;/span&gt;
         &lt;/td&gt;
         &lt;td&gt;116.098&lt;/td&gt;
         &lt;td&gt;116.156&lt;/td&gt;
      &lt;/tr&gt;
   &lt;/tbody&gt;
&lt;/table&gt;
</code></pre>

<p>On this page I have another table with the same class attribute "report" but only this table contains texts "Position Open" and "Position Closed".
I need to select elements containing the "EURJPY", "116.098" and "116.156" data.
These elements content is changing i.e. instead of "EURJPY" may appear "EURUSD" or "GBPCAD" etc.
I tried the following code:  </p>

<pre><code>driver.findElement(By.xpath("//span[text()='Position Open']/ancestor::table[@class='report'](//tr)[2]/td/span")).getAttribute("textContent");  
</code></pre>

<p>to get the first required field text but got the <code>Invalid selector</code> error.</p>