title: Is it possible to use a xpath within a xpath?
body: <p>I have a table that looks like this:</p>
  
  <pre><code>&lt;table&gt;     
      &lt;thead&gt;
          &lt;tr&gt;
            &lt;th data-th-key="col1"&gt; &lt;span&gt; Foo &lt;/span&gt;  &lt;/th&gt;
            &lt;th data-th-key="col2"&gt; &lt;span&gt; Bar &lt;/span&gt;  &lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
          &lt;tbody&gt;
              &lt;tr&gt;   
          &lt;td&gt;
                  &lt;div&gt;
                &lt;input data-model-key="col1"&gt;    
              &lt;/div&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;div&gt;
                &lt;input data-model-key="col2"&gt;    
              &lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
          &lt;/tbody&gt;
  &lt;/table&gt;    
  </code></pre>
  
  <p>To find the right input element I have to know the data-th-key from the table head. Is there any way to use the first xpath inside the second one?</p>
  
  <p>Xpath one:</p>
  
  <pre><code>//table//thead//span[translate(normalize-space(.),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='foo']/parent::th/@data-th-key"
  </code></pre>
  
  <p>Xpath two:</p>
  
  <pre><code>//table//tbody//tr//td//div//input[@data-model-key='col1']
  </code></pre>
  
  <p>So I want to replace the col1 value in the second one with Xpath one.</p>