title: XPath position where text (or attribute) is equal to value
body: <p>XML:</p>
  
  <pre><code>&lt;row type="header"&gt;
   &lt;column&gt;href&lt;/column&gt;
   &lt;column&gt;other&lt;/column&gt;
  &lt;/row&gt;
  &lt;row type="data"&gt;
   &lt;column&gt;a&lt;/column&gt;
   &lt;column&gt;b&lt;/column&gt;
  &lt;/row&gt;
  </code></pre>
  
  <p>XSLT:(I'm making sure I'm in row[@type='data']/column in the template below)</p>
  
  <pre><code>&lt;xsl:template match="column" mode="panelTabsBody"&gt;
   &lt;td&gt;
    &lt;a&gt;
     &lt;xsl:attribute name="href"&gt;
      &lt;xsl:value-of select="../../row[@type='header']/column[text()='href'][position()]" /&gt;
     &lt;/xsl:attribute&gt;
    &lt;/a&gt;
   &lt;/td&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>How can I get the column position where the text() is equal to href? If it's easier, I can give the column with the value 'href' an attribute. Example: <code>&lt;column type='link'&gt;href&lt;/column&gt;</code></p>
  
  <p><strong>Edit:</strong><br>
  I tried the following, but this didnt work<br>
  XSLT:</p>
  
  <pre><code>&lt;xsl:template match="column" mode="panelTabsBody"&gt;
   &lt;xsl:variable name="testt" select="count(../../row[@type='header']/column[text()='href']/preceding-sibling::column) + 1" /&gt;
   &lt;td&gt;
    &lt;a&gt;
     &lt;xsl:attribute name="href"&gt;
      &lt;xsl:value-of select="../../row[@type='header']/column[position() = testt]" /&gt;
     &lt;/xsl:attribute&gt;
    &lt;/a&gt;
   &lt;/td&gt;
  &lt;/xsl:template&gt;
  </code></pre>