Subject: Re: [xsl] Grouping repeating elements within repeating elements From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 26 Nov 2007 22:31:12 -0500 |
I have been doing XSLT for about four years now and this input XML has me a little stumped as to how to implement. I believe I am using Xalan 2.6 (bundled as part of an EMC Documentum product called WebPublisher) and the only version it supports currently is XSLT 1.0.
Here is the XML input:
...
Basically, I need to group any category/content_category_faq under the appropriate heading designation so like the following:
Benefits Health Medical Coverage Medical Coverage-PPO Medical Coverage-HMO Dental Financial Flexible Spending Life Events Getting Married Adoption
I am in the introductory stages on development on this so I don't have any existing XSL to demonstrate but I am hoping to make some headway today so I can repost but any initial help would be very cool. I am working on some recurse logic as we speak.
T:\ftemp>type cindy.xml <?xml version="1.0" encoding="UTF-8"?> <content> <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>
T:\ftemp>type cindy.xsl <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/"> <!--start everything off with the first heading using all FAQs available--> <xsl:call-template name="next-heading"> <xsl:with-param name="faqs" select="/content/faq_listing"/> </xsl:call-template> </xsl:template>
</xsl:stylesheet> T:\ftemp>call xslt cindy.xml cindy.xsl cindy.txt
T:\ftemp>type cindy.txt Benefits Health Medical Coverage Medical Coverage - PPO Medical Coverage - HMO Dental Financial Flexible Spending Life Events Getting Married Adoption
-- Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008 World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Grouping repeating elemen, Cynthia Arangua | Thread | [xsl] Select Parent when child exis, Tim Gaunt |
RE: [xsl] Grouping repeating elemen, Cynthia Arangua | Date | Re: [xsl] Converting a string to Up, Colin Adams |
Month |