Subject: [xsl] Multiple instances of the same nodeset - is this possible. From: John Aschenbrenner <jaschenbrenner@xxxxxxxxxxxxxxx> Date: Sun, 4 Aug 2002 15:00:55 -0700 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Re: css or xsl for increa, Michael Leditschke | Thread | RE: [xsl] Multiple instances of the, Michael Kay |
[xsl] Re: css or xsl for increasing, Dimitre Novatchev | Date | RE: [xsl] Re: Efficiency, use param, Michael Kay |
Month |