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

Multiple instances of the same nodeset - is this possi

Subject: Multiple instances of the same nodeset - is this possible.
From: John Aschenbrenner <jaschenbrenner@xxxxxxxxxxxxxxx>
Date: Sun, 4 Aug 2002 15:00:55 -0700
i like possi
I often find myself in a situation where I would like to traverse a nodeset
multiple times simultaneously in a document.
Example:
	<root>
	  <row FieldName="CustName" Message="FREELOADER FREDDIE"/>
	  <row ListID="391" FieldName="ListOfMessages" Message="This is a
message." MessageID="391" IsNewline="True"/>
	  <row ListID="402" FieldName="ListOfMessages" Message="Freddie has
up to 1 full month" MessageID="402" IsNewline="True"/>
	  <row ListID="403" FieldName="ListOfMessages" Message="to pay off
his bill." MessageID="402" IsNewline="False"/>
	  <row ListID="408" FieldName="ListOfMessages" Message="Most recent
data for FREELOADER FREDDIE." MessageID="408" IsNewline="True"/>
	  <row ListID="415" FieldName="ListOfMessages" Message="Favorite
sports and hobbies: Bicycling backgammon" MessageID="415" IsNewline="True"/>
	  <row ListID="416" FieldName="ListOfMessages" Message="and
sailing." MessageID="415" IsNewline="False"/>
	  <row ListID="514" FieldName="ListOfMessages" Message="Signed
liability waiver If participating in category" MessageID="514"
IsNewline="True"/>
	  <row ListID="515" FieldName="ListOfMessages" Message="A sporting
activities." MessageID="514" IsNewline="False"/>
	</root>


What I would like to do with this data is output it in a tabular format.  If
the attribute IsNewline="True" then I have the beginning of a new record
else just concatenate it to the previous.

I have a template that looks like this.
    <xsl:template name="GetMessages">
      <xsl:param name="GetMessagesSet1"/>
      <xsl:param name="GetMessagesSet2"/>

        <xsl:for-each select="$GetMessagesSet1[@IsNewline='True']">
          <xsl:variable name="i" select="position()"/>
          <xsl:variable name="MessageID"
select="$GetMessagesSet1[$i]/@ListID"
        	<tr>
        		<td valign="bottom" align="left" width="10%">
        			<p class="feedbackMsg">______</p>
        		</td>
        		<td align="left" width="80%">
        			<p class="feedbackMsg">

          			<xsl:for-each
select="$GetMessagesSet2[@MessageID=$MessageID]">
          			  <xsl:variable name="j"
select="position()"/>
          			  <xsl:value-of
select="$GetMessagesSet1[@MessageID=$MessageID][$j]/@Message"/>
          			</xsl:for-each>
          			
        			</p>
        		</td>
        		<td valign="bottom" align="middle" width="10%">
        			<p class="feedbackMsg">________________</p>
        		</td>
        	</tr>
        </xsl:for-each>
        
    </xsl:template>

As you may have guessed when I call this template as follows
<xsl:call-template name="GetMessages">
  <xsl:with-param name="GetMessagesSet1"
select="z:row[@FieldName='ListOfMessages']"/>
  <xsl:with-param name="GetMessagesSet2"
select="z:row[@FieldName='ListOfMessages']"/>
</xsl:call-template>

it does not work as I would like because even though I think I have created
two independent nodesets.  I only have one.

My question is this - Is it somehow possible to have two independent
nodesets with identical data that you can traverse simultaneously?

I have since solved my problem by using a recursive template - however I
would still like my question answered.

Thank you,
John Aschenbrenner
Ignition Mortgage Technology Solutions, Inc.
jaschenbrenner@xxxxxxxxxxxxxxx
Ph: (253)858-8955 x 239
http://www.ignitionmts.com




 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.