Can you scrape a header for a table, and then include that header in each of the table row results?

Comments

1 comment

  • Avatar
    Ryan McNally

    Hi Marc!

    So with this site and what you want to accomplish, we have to use some manual XPath make this work. This solution will follow Part 2 and Part 3 of the Advanced XPath tutorial we have.

    On the page itself, we can inspect the source HTML and construct this row XPath to set the correct rows in the table as the rows:

    //tr[contains(@class,"staff_dgrd_item") or contains(@class,"staff_dgrd_alt")]

    With that, we can then update the row XPath in the Import.io product:

    Finally, we can then use manual xpath with preceding-sibling to capture the department:

    ./preceding-sibling::tr[not(@class)][1]/td[1]

    I've put together this fix at https://app.import.io/dash/extractors/4eaf6371-b8d4-4d28-b234-534c10f70a11 which you should be able to copy over to your account by clicking the Duplicate button.

    Hope that helps out!

Please sign in to leave a comment.