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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:35:16+00:00 2026-06-15T15:35:16+00:00

I can choose several paths using .//div/h1/text() | .//div/h2/text() . However I would like

  • 0

I can choose several paths using .//div/h1/text() | .//div/h2/text(). However I would like to know if there’s a way of doing it without explicitly writing out the part that is common for both path’s – in this case .//div/ – every time?

  • 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-15T15:35:18+00:00Added an answer on June 15, 2026 at 3:35 pm

    As for shortcuts, with XPath 2.0 you can shorten e.g. //div/h1 | //div/h2 to e.g. //div/(h1 | h2) but that syntax is not allowed in XPath 1.0. And I think XPath 3.0 will introduce a let clause to define variables. So there I think you can do e.g. let $r := /html/body/div[3]/table[2]/tbody/tr[5] return ($r/span | $r/a).

    Or for your corrected sample with XPath 2.0 you can shorten .//div/h1/text() | .//div/h2/text() to .//div/(h1/text() | h2/text()). But with XPath 1.0 all you can do is use .//div/*[self::h1 | self::h2]/text().

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

Sidebar

Related Questions

i would like to know a good software engineering way to store user preferences
I can choose the navigator I want using ⌘ + 1 , ⌘ +
In HDF5 library virtual file layer, we can choose between several options. The default
How do I make a Django form where the user can choose between several
I am writing an Android application where the user can choose several stocks to
In the visual studio project settings you can choose a strong name key file
I am working on a iOS 5 iPhone project where users can choose an
I need to create a Word template where I can choose from different paragraphs
I'm developing a little portfolio where I can choose a category and when I
I need to generate a report where the user can choose All Issues, Open

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.