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

Create for-each loop inside another loop base on the

Subject: Create for-each loop inside another loop base on the first Element
From: "Kevin Yao" <KYao@xxxxxxxxxxxxxx>
Date: Mon, 6 Mar 2006 07:39:55 -0600
segment lin
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-235>UA</Element-235>
      <Element-234>007342000014</Element-234>
      <Element-235_1>PI</Element-235_1>
      <Element-234_1>36200017</Element-234_1>
      <Element-235_2>VN</Element-235_2>
      <Element-234_2>00014</Element-234_2>
    </Segment-LIN>
    <Segment-PO4>
      <Element-356>12</Element-356>
      <Element-357>16.000000</Element-357>
      <Element-355_1>OZ</Element-355_1>
      <Element-187>G</Element-187>
      <Element-384>13.500000</Element-384>
      <Element-355_2>LB</Element-355_2>
    </Segment-PO4>
    <Loop-FST>
      <Segment-FST>
        <Element-380_2>462.000000</Element-380_2>
        <Element-680>D</Element-680>
        <Element-681>X</Element-681>
        <Element-373>20060115</Element-373>
        <Element-373_1>20060121</Element-373_1>
      </Segment-FST>
      <Segment-SDQ>
        <Element-355>CA</Element-355>
        <Element-66>9</Element-66>
        <Element-67_1>0091372090506</Element-67_1> [Please note that
this is the LOCATION # that I want to start the loop with]
        <Element-380_2>143.000000</Element-380_2>
        <Element-67>0091372091009</Element-67>
        <Element-380>122.000000</Element-380>
        <Element-67_2>0091372091729</Element-67_2>
        <Element-380_1>108.000000</Element-380_1>
        <Element-67_3>0091372092022</Element-67_3>
        <Element-380_3>49.000000</Element-380_3>
        <Element-67_4>0091372092023</Element-67_4>
        <Element-380_4>40.000000</Element-380_4>
      </Segment-SDQ>
    </Loop-FST>
    <Loop-FST>
      <Segment-FST>
        <Element-380_2>400.000000</Element-380_2>
        <Element-680>D</Element-680>
        <Element-681>X</Element-681>
        <Element-373>20060122</Element-373>
        <Element-373_1>20060128</Element-373_1>
      </Segment-FST>
      <Segment-SDQ>
        <Element-355>CA</Element-355>
        <Element-66>9</Element-66>
        <Element-67_1>0091372090506</Element-67_1>
        <Element-380_2>120.000000</Element-380_2>
        <Element-67>0091372091009</Element-67>
        <Element-380>89.000000</Element-380>
        <Element-67_2>0091372091729</Element-67_2>
        <Element-380_1>114.000000</Element-380_1>
        <Element-67_3>0091372092022</Element-67_3>
        <Element-380_3>42.000000</Element-380_3>
        <Element-67_4>0091372092023</Element-67_4>
        <Element-380_4>35.000000</Element-380_4>
      </Segment-SDQ>  +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,.....- The output of the Element-67_4 at the first Loop-FST
can be different than the third Loop-FST)
    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

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.