Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7770131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:19:59+00:00 2026-06-01T16:19:59+00:00

I played with different XPath queries with XPather (works only with older firefox versions)

  • 0

I played with different XPath queries with XPather (works only with older firefox versions) and notice a difference between the results from the following queries

This one shows some results

//div[descendant::table/descendant::td[4]] 

This one lists empty list

//div[//table//td[4]]

Are they different due to some rules or it’s just misbehavior of particular implementation of XPath interpreter? (Seems like used from FF engine, XPather is just an excellent simple GUI for querying)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:20:00+00:00Added an answer on June 1, 2026 at 4:20 pm

    With XPath 1.0 // is an abbreviation for /descendant-or-self::node()/ so your first path is /descendant-or-self::node()/div[descendant::table/descendant::td[4]] while the second is rather different with /descendant-or-self::node()/div[/descendant-or-self::node()/table/descendant-or-self::node()/td[4]]. So the major difference is that inside your first predicate you look down for descendants relative to the div element while in the second predicate you look down for descendants from the root node / (also called the document node).
    You might want //div[.//table//td[4]] for the second path expression to come closer to the first one.

    [edit]
    Here is a sample:

    <html>
      <body>
        <div>
          <table>
            <tbody>
              <tr>
                <td>1</td>
              </tr>
              <tr>
                <td>2</td>
              </tr>
              <tr>
                <td>3</td>
              </tr>
              <tr>
                <td>4</td>
              </tr>
            </tbody>
          </table>
        </div>
      </body>
    </html>
    

    With that sample the path //div[descendant::table/descendant::td[4]] selects the div element as it has a table child which has a fourth td descendant.

    However with //div[.//table//td[4]] we look for //div[./descendant-or-self::node()/table/descendant-or-self::node()/td[4]] which is short for //div[./descendant-or-self::node()/table/descendant-or-self::node()/child::td[4]] and there is no element having a fourth td child element.

    I hope that explains the difference, if you use //div[.//table/descendant::td[4]] then you should get the same result as with your original form.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have played around with many different queries, but haven't been able to locate
I've tried everything... it won't hide. Obviously tried Mouse.hide() tried different player versions (10.2,
I have played for a while writing XPath but am unable to come up
Can YouTube videos be played from within an AndroidOS without launching the separate YouTube
Perverse Hangman is a game played much like regular Hangman with one important difference:
I want to play some videos with audio from different audio files. For this
O.K , so I'm using core audio to extract audio from 10 different sample
I have an sqlite table that shows scores from different game modes. In one
i'm developing an application that'll be played by different's users, but i'm using the
I played around with a lot of different forward declaration combinations, this seemed like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.