Harmen's answer is exactly what you need for a clean XPATH solution.
If you are really interested in performance , then you can define the XSLT key :
<xsl:key name="columns" match="/html/body/table/tr/th" use="text()"/>
and then use the key in the predicate filter:
/html/body/table/tr/td[count(key('columns', 'HeaderC')/preceding-sibling::th)+1]
However, I suspect that you probably wonβt be able to see a measurable difference in performance unless you need to filter a lot by column (for example, for each ) with checks for each row for a really large document).
Mads hansen
source share