Skip to content

The trick to find a <td> by its corresponding <th> position in XPath? #111

Closed Answered by yajo
yajo asked this question in Q&A
Discussion options

You must be logged in to vote

Ha! Found it!

Well, for the sake of the next one coming to this (including my future self), this was the solution:

    <template id="report_delivery_document" inherit_id="stock.report_delivery_document">
        <xpath expr="//table[@name='stock_move_table']/tbody//td[
                1 + count(
                    //table[@name='stock_move_table']
                    //th[@name='th_sm_ordered']
                    /preceding-sibling::*
                )
            ]" position="inside">
            <!-- Yay! 🎉 -->
        </xpath>
    </template>

Inspiration: https://stackoverflow.com/a/227080/1468388

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@simahawk
Comment options

Answer selected by yajo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants