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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:40:48+00:00 2026-05-18T09:40:48+00:00

I want to retrieve the data of the next element tag in a document,

  • 0

I want to retrieve the data of the next element tag in a document, for example:

I would like to retrieve <blockquote> Content 1 </blockquote> for every different span only.

<html>
<body>


<span id=12341></span>
<blockquote>Content 1</blockquote>
<blockquote>Content 2</blockquote>

<!-- misc html in between including other spans w/ no relative blockquotes-->

<span id=12342></span>
<blockquote>Content 1</blockquote>

<!-- misc html in between including other spans w/ no relative blockquotes-->

<span id=12343></span>
<blockquote>Content 1</blockquote>
<blockquote>Content 2</blockquote>
<blockquote>Content 3</blockquote>
<blockquote>Content 4</blockquote>

<!-- misc html in between including other spans w/ no relative blockquotes-->    

<span id=12344></span>
<blockquote>Content 1</blockquote>
<blockquote>Content 2</blockquote>
<blockquote>Content 3</blockquote>


</body>
</html>

Now two things I’m wondering:

1.)How can I write an expression that matches and only outputs a blockquote that’s followed right after a closed element (<span></span>)?

2.)If I wanted, how could I get Content 2, Content 3, etc if I ever have a need to output them in the future while still applying to the rules of the previous question?

  • 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-18T09:40:49+00:00Added an answer on May 18, 2026 at 9:40 am

    Now two things I’m wondering:

    1.)How can I write an expression that matches and only outputs a blockquote
    that’s followed right after a closed
    element (<span></span>)?

    Assuming that the provided text is converted to a well-formed XML document (you need to enclose the values of the id attributes in quotes)

    Use:

    /*/*/span/following-sibling::*[1][self::blockquote]
    

    This means in English: Select all blockquote elements each of which is the first, immediate following sibling of a span element that is a grand-child of the top element of the document.

    2.)If I wanted, how could I get Content 2, Content 3, etc if I ever
    have a need to output them in the
    future while still applying to the
    rules of the previous question?

    Yes.

    You can get all sets of contigious blockquote elements following a span:

     /*/*/span/following-sibling::blockquote
              [preceding-sibling::*[not(self::blockquote)][1][self::span]]
    

    You can get the contigious set of blockquote elements following the (N+1)-st span by:

    /*/*/span/following-sibling::blockquote
               [preceding-sibling::*
                 [not(self::blockquote)][1]
                    [self::span and count(preceding-sibling::span)=$vN]
               ]
    

    where $vN should be substituted by the number N.

    Thus, the set of contigious set of blockquote elements following the first span is selected by:

    /*/*/span/following-sibling::blockquote
               [preceding-sibling::*
                 [not(self::blockquote)][1]
                    [self::span and count(preceding-sibling::span)=0]
               ]
    

    the set of contigious set of blockquote elements following the second span is selected by:

    /*/*/span/following-sibling::blockquote
               [preceding-sibling::*
                 [not(self::blockquote)][1]
                    [self::span and count(preceding-sibling::span)=1]
               ]
    

    etc. …

    See in the XPath Visualizer the nodes selected by the following expression :

    /*/*/span/following-sibling::blockquote
               [preceding-sibling::*
                 [not(self::blockquote)][1]
                    [self::span and count(preceding-sibling::span)=3]
               ]
    

    alt text

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

Sidebar

Related Questions

I have DropDownList with CascadingDropDown extender. If I want to retrieve data from the
I am using MySQL as DB and I want to retrieve table data to
I want to store and retrieve data that is accessible to all activities in
I want to retrieve the latitude and the longitude of a data which is
My app is calling a web service to retrieve some data, and I want
I want applications to share certain database data. I want one application to retrieve
I have two XML sources to retrieve data from. I want to use them
I use the next code to retrieve data from a table in the database:
I have the next code to retrieve some data from a xml file. The
i want to retrieve data which their price field is between a certain max

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.