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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:35:16+00:00 2026-05-23T09:35:16+00:00

A little background: I was rendering some XML on the page using XSLT, but

  • 0

A little background: I was rendering some XML on the page using XSLT, but we decided to make it more interactive and so now I’m doing a jQuery.ajax call to return the XML, and I’m parsing it in JavaScript.

I’ve been able to extract particular nodes from it using code like

var qpPlanNode = $(xml).find('MyNode'); 
var qpPlanNum = $(qpPlanNode).children('PLANNUM').text();

And that gets the plan number into qpPlanNum. But in that XML I have something like

<xml>
  <MyNode>
    <PLANNUM>123</PLANNUM>
    <SOURCE>
      <TYPE>PreTax</TYPE>
      <AMOUNT>1234</AMOUNT>
    </SOURCE>
    <SOURCE>
      <TYPE>AfterTax</TYPE>
      <AMOUNT>456</AMOUNT>
    </SOURCE>
    <SOURCE>
      <TYPE>PreTax</TYPE>
      <AMOUNT>234</AMOUNT>
    </SOURCE>
  </MyNode>
</xml>

I would like to extract all the SOURCE nodes that have a particular value for TYPE. I can’t find a simple jQuery selector that that will do that. In XSLT, I was doing <xsl:variable name="afterTaxSources" select="SOURCE[TYPE = 'AfterTax']"/>. What’s the JQuery equivalent?

  • 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-23T09:35:17+00:00Added an answer on May 23, 2026 at 9:35 am

    I just stumbled on this one, which seems like it is working:

    var pretaxSources = $(qpPlanNode).find('SOURCE:has(TYPE:contains("PreTax"))');
    

    Does anybody see any reason why it wouldn’t?

    Even better, I can combine multiple types using

    var pretaxSources = $(qpPlanNode).find('SOURCE:has(TYPE:contains("PreTax"),TYPE:contains("Employee"))');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A little background first: I'm a designer/developer and decided to use subversion for a
First a little background, I'm using jdk 1.6. I've got a 2 column table
A little background: I'm using Spring and Hibernate to create a really simple domain/dao/service
A little background: as a way to learn multinode trees in C++, I decided
A little background here: I know what a data warehouse is , more or
A little background. I am using plupload to upload files within my application. The
Here's a little background on my solution: ASP.Net MVC app Using Linq-to-SQL with table-per-hierarchy
Now this is going to be a little weird use-case. Maybe someone has some
Little background.. I'm in the process of making an OpenGL game using Java and
Just a little background: I am using Access 2010 to create forms and VBA

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.