I've learned it was a grouping problem and applied to following style sheet
to it (see below) ... however my select=".." for pulling the values is
pulling null values. What am I missing?
Thank you very much in advance ...
-Kevin
-----------------------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="plans">
<HTML><BODY>
<xsl:variable name="plan" select="*"/>
<TABLE width='100%'>
<TR>
<TH> Plans </TH>
<xsl:for-each select="$plan"> <xsl:sort/>
<TH>
<xsl:value-of select="@name"/>
</TH>
</xsl:for-each>
</TR>
<xsl:for-each select="plan/descriptor[ not (./@descriptor_name =
preceding::descriptor/@descriptor_name) ]">
<xsl:sort/>
<xsl:variable name="descriptor_name" select="@descriptor_name"/>
<TR>
<TD align='center'>
<xsl:value-of select="$descriptor_name"/>
</TD>
<xsl:for-each select="$plan">
<xsl:sort/>
<xsl:variable name="plan_name" select="@name"/>
<TD align='center'>
value: <xsl:value-of
select="/doc/plans/plan/descriptor[descriptor/@descriptor_name =
$descriptor_name and @name = $plan_name]/@value" /><br/>
</TD>
</xsl:for-each>
</TR>
</xsl:for-each>
</TABLE>
</BODY></HTML>
</xsl:template>
</xsl:stylesheet>
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of
Kevin
Callahan
Sent: Wednesday, April 09, 2003 4:03 PM
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] RE: xslt: nested for-each loops and other
transformations?
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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list