RE: [xsl] Create for-each loop inside another loop base on the first Element

Subject: RE: [xsl] Create for-each loop inside another loop base on the first Element
From: cknell@xxxxxxxxxx
Date: Fri, 03 Mar 2006 11:26:10 -0500
It will be simpler for us to help you if you included the actual XML you are trying to transform. The stuff you sent requires us to convert it to XML ourselves to work on it. The easier you make it for us, the more likely you are to get help.
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Kevin Yao <KYao@xxxxxxxxxxxxxx>
Sent:     Fri, 3 Mar 2006 10:23:16 -0600
To:       <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject:  [xsl] Create for-each loop inside another loop base on the first Element

First time using this XSLT programming. I had some help over at the
Stylus Studio Forum but it seems that my problem is quite complex.
Here is the situation:
 
-Loop-LIN
  Segment-LIN
    Element-234
    Element-357
  Segment-PO4
  Loop-FST
     Segment-FST
        Element-373
        Element-373_1
        Element-380_2
     Segment-SDQ
        Element-67_1
        Element-67
        Element-67_2
        Element-67_3
        Element-67_4
        Element-67_5
        Element-67_6
        Element-67_7
        Element-67_8
        Element-67_9
  +Loop-FST
  +Loop-FST
  +Loop-FST
  +Loop-FST
+Loop-LIN
+Loop-LIN
+Loop-LIN
+Loop-LIN
+Loop-LIN
+Loop-LIN
 
Here is what I need it to output:
 
<xsl:for-each select="Loop-FST/Segment-SDQ/Element-67*"> (* can be
1,2,3,4,5,.....)
    Employee: <xsl:value-of select="Element-67*">
    <xsl:for-each select="Loop-LIN"> 
    <xsl:value-of select="Segment-LIN/Element-234">
    <xsl:value-of select="Segment-LIN/Element-257">
    <xsl:value-of select="Loop-FST/Segment-FST/Element-373">
    <xsl:value-of select="Loop-FST/Segment-FST/Element-373_1">
    <xsl:value-of select="Loop-FST/Segment-FST/Element-380_2">
    </xsl:for-each>
</xsl:for-each>
 
The second <xsl:for-each select="Loop-LIN"> needs to output whatever the
first <xsl:for-each ....."Element67*"> is. The difficulty is that the
first Element-67_3 in Loop-FST might be different than the third
Loop-FST.
 
Any help would be appreciated.
 
~Kevin

Current Thread