[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xslt: nested for-each loops and other transformati

Subject: RE: xslt: nested for-each loops and other transformations?
From: "Kevin Callahan" <kevincal@xxxxxxxxxxxxx>
Date: Wed, 9 Apr 2003 16:02:53 -0400
xslt nested for each
I didn't know if I posted this before I had an activated account...

I am trying to figure out nested for-each looping and am finding no real
examples to help with this use case (or is there a better way than using
for-each?):

I have an xml document (xmlDocument) that looks like

<plans>

	<plan name="Plan A" id="1" quote="44.50">

		<descriptor descriptor_name="Provider" descriptor_id="44"
anchor="PROVIDER"
		value="Provider A"\>

		<descriptor descriptor_name="Underwriter" descriptor_id="45"
		anchor="UNDERWRITER" value="Underwriter A"\>

		<descriptor descriptor_name="Eligibility" descriptor_id="46"
		anchor="ELEGIBILITY" value="US Residents Only"\>

		<descriptor descriptor_name="Length of Coverage" descriptor_id="47"
		anchor="COVERAGE" value="30 day max."\>

		<descriptor .../>

</plan>

<plan name="Plan B" id="2" quote="77.50">

		<descriptor descriptor_name="Provider" descriptor_id="44"
anchor="PROVIDER"
		value="Provider B"\>

		<descriptor descriptor_name="Underwriter" descriptor_id="45"
		anchor="UNDERWRITER" value="Underwriter B"\>

		<descriptor descriptor_name="Eligibility" descriptor_id="46"
		anchor="ELEGIBILITY" value="No Over 80"\>

		<descriptor descriptor_name="Length of Coverage" descriptor_id="47"
		anchor="COVERAGE" value="180 day max."\>

		<descriptor .../>

</plan>

<plan name="Plan C" id="3" quote="99.50">

		<descriptor descriptor_name="Provider" descriptor_id="44"
anchor="PROVIDER"
		value="Provider C"\>

		<descriptor descriptor_name="Underwriter" descriptor_id="45"
		anchor="UNDERWRITER" value="Underwriter C"\>

		<descriptor descriptor_name="Eligibility" descriptor_id="46"
		anchor="ELEGIBILITY" value="All"\>

		<descriptor descriptor_name="Length of Coverage" descriptor_id="47"
		anchor="COVERAGE" value="30 day max."\>

		<descriptor .../>

</plan>

</plans>

The problem is that the xlst must take into account that the <descriptor..>
field is dynamic but will have the same # and type between plans.

I want to generate an html table that looks somewhat like:

<tr><td>Plan</td><td>Plan A</td><td>Plan B</td><td>Plan C</td></tr>

<tr><td>Provider</td><td>Provider A</td><td>Provider
B</td><td>ProviderC</td></tr>

<tr><td>Underwriter</td><td>Underwriter A</td><td>Underwriter
B</td><td>Underwriter C</td></tr>

.. etc

How would I achieve this two-prong looping in the xslt file? I know I can
use the <xsl:for-each ..\> tag but is there a way to populate a temporary
scheme of just <descriptors><descriptor/></descriptors> and then have a loop
through that?

Thank you very much in advance for any help!

-kevin



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.