468,290 Members | 2,078 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,290 developers. It's quick & easy.

Looking to traverse tree and group elements with identical xpath elements

Hi-
I have the following XML structure:
<?xml version="1.0" encoding="UTF-8"?>
<content>
<type content_type="Listing"/>
<faq_listing>
<heading>Benefits</heading>
<heading>Health</heading>
<heading>Medical Coverage</heading>
<category>
<content_category_faq>Medical Coverage - PPO</content_category_faq>
</category>
<category>
<content_category_faq>Medical Coverage - HMO</content_category_faq>
</category>
</faq_listing>
<faq_listing>
<heading>Benefits</heading>
<heading>Health</heading>
<category>
<content_category_faq>Dental</content_category_faq>
</category>
</faq_listing>
<faq_listing>
<heading>Benefits</heading>
<heading>Financial</heading>
<category>
<content_category_faq>Flexible Spending</content_category_faq>
</category>
</faq_listing>
<faq_listing>
<heading>Life Events</heading>
<category>
<content_category_faq>Getting Married</content_category_faq>
</category>
<category>
<content_category_faq>Adoption</content_category_faq>
</category>
</faq_listing>
</content>

I am looking to do something like the following to display the results:

- Benefits
- Health
- Medical Coverage
+ Medical Coverage - PPO
+ Medical Coverage - HMO
+ Dental (faq cat)
- Financial
+ Flexible Spending
- Life Events
+ Getting Married
+ Adoption

I have the HTML and Javascript to do the +/- but was looking to see if anyone had any ideas on how I could "group" like xpath values?

Thanks!
BoarderChic
Nov 25 '07 #1
1 1199
jkmyoung
2,057 Expert 2GB
Are you using DOM, or XSLT?
One way to group using XSLT: Muenchian Grouping
http://www.jenitennison.com/xslt/gro...muenchian.html
Nov 26 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Rolf Kemper | last post: by
4 posts views Thread by Gerald Aichholzer | last post: by
4 posts views Thread by Wayne Wengert | last post: by
19 posts views Thread by phoenixathell | last post: by
8 posts views Thread by =?ISO-8859-1?Q?m=E9choui?= | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.