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 844279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:15:38+00:00 2026-05-15T06:15:38+00:00

I maybe be trying to do something invalid here, but maybe someone smarter than

  • 0

I maybe be trying to do something invalid here, but maybe someone smarter than me knows the correct syntax to solve my problem.
Given:


    <group code="vehicle">
        <line code="car">
            <cell>
                <box code="price">1000.00</box>
            </cell>
        </line>
        <line code="car">
            <cell code="sports">
                <box code="price">500.00</box>
            </cell>
        </line>
    </group>

If I use //*[@code="vehicle"]//*[@code="car"]//*[@code="price"], I will get both boxes returned (1000.00 and 500.00)–as expected but not what I want.

Is there an xpath syntax that will evaluate against all nodes that have an attribute of @code rather than skipping it if it doesn’t match with the end result being that I only get back the first box (price of 1000.00)? Like asking, choose the first node with @code and that @code must equal “vehicle”, then choose the next node with @code and that @code must equal “car”, then choose the next node with @code and @code must equal “price”.

  • 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-05-15T06:15:39+00:00Added an answer on May 15, 2026 at 6:15 am

    Use:

       "//box
           [(@code='car' or @code='price' or @code='vehicle')
          and
           not(
                 ancestor-or-self::*
                       [
                           @code
                          and
                           not(@code='car'
                                  or
                                   @code='price'
                                  or
                                   @code='vehicle'
                               )
    
                       ]
                   )
           ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to wrap my head around something; maybe someone here can point me
Maybe im missing something but im not sure. All im simply trying to do
Maybe this is a shot in the dark here but I'm trying to find
Maybe I'm wrong but for me its not working, I'm trying to do the
Maybe I'm just an idiot, but I've been trying to implement a game loop
Maybe my question it's a little weird, but I'm trying to build a not-so-simple
maybe it's not so proper to ask this question here... anyway, I'm trying to
I'm trying to do something but I can't find any solution, I'm also having
I am trying to do something very simple: create a new branch. But I
maybe what I'm trying to achieve is a non-sense, but I think it should

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.