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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:09:28+00:00 2026-05-12T05:09:28+00:00

Here is the my structure: <AllCharges> <Charge> <ID>1</ID> <Type>A</Type> </Charge> <Charge> <ID>2</ID> <Type>A</Type> </Charge>

  • 0

Here is the my structure:

<AllCharges>
   <Charge>
     <ID>1</ID>
     <Type>A</Type>
   </Charge>
   <Charge>
     <ID>2</ID>
     <Type>A</Type>
   </Charge>
   <Charge>
     <ID>3</ID>
     <Type>B</Type>
   </Charge>
</AllCharges>

What I want back is the full structure but I only want results in which the Type = A. The hard part I am finding is pulling back the parent xml nodes. Here is an example of what my result should look like:

<AllCharges>
   <Charge>
     <ID>1</ID>
     <Type>A</Type>
   </Charge>
   <Charge>
     <ID>2</ID>
     <Type>A</Type>
   </Charge>
</AllCharges>

I would assume the XPath would look something like this but it doesn’t work:
/AllCharges[//Type=A]

Is this possible?

  • 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-12T05:09:28+00:00Added an answer on May 12, 2026 at 5:09 am
    /AllCharges/Charge[Type='A']
    

    That should do it.

    The expression reads, “Select any Charge element whose parent is AllCharges, having a child element called Type whose text value is ‘A’.”

    Tested it in the following XSLT template:

    <xsl:template match="/">
      <AllCharges>
        <xsl:copy-of select="/AllCharges/Charge[Type='A']"/>
      </AllCharges>
    </xsl:template>
    

    The output was:

    <AllCharges>
      <Charge>
        <ID>1</ID>
        <Type>A</Type>
      </Charge>
      <Charge>
        <ID>2</ID>
        <Type>A</Type>
      </Charge>
    </AllCharges>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a table structure (e.g. test): Field Name Data Type id BIGINT (20)
Here is the structure of the content, I want to select all LI except
I want to create a full text search using MsSql 2005. Here is the
Sorry for this maybe foolish question but i'm newbie to SQL Server. Here structure
I have a mysql table with contents the structure is here: I want to
last time I asked how to populate a data structure here . Now I
I have a complex form in Ruby on Rails 2.3.5, here's the structure for
here is my directory structure. /user/a /user/b /user/b inside folder a,b,c there is a
Here I have: Public Structure MyStruct Public Name as String Public Content as String
Here is my data structure alt text http://luvboy.co.cc/images/db.JPG when i try this sql select

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.