[xsl] Comparing an XML value from current record and previous record

Subject: [xsl] Comparing an XML value from current record and previous record
From: Brett Luntz <brettluntz@xxxxxxxxx>
Date: Fri, 11 May 2007 00:28:52 +1000 (EST)
Hi,
 
I am new to XSL and have some code that I need edited.

We are currently looping through an XML recordset. 

We need an if statement that checks the current and
previous record's value of the XML tag
"HORSE_FRONT_ROW_FLAG".  If the current record's value
of HORSE_FRONT_ROW_FLAG tag is "2", and the previous
record's value of HORSE_FRONT_ROW_FLAG is "1", then
the system needs to print some text....  

This is the current code:

<xsl:for-each select="RACE_LIST_HORSES/HORSE">
 <section startonnewpage="false" pagesize="a5"
leftmargin="1cm" rightmargin="1cm" topmargin="1cm"
bottommargin="1cm">
                                         <paragraph
type="textparagraph" alignment="center">
                                             <fragment
font="Helvetica" fontsize="10">
------------------------------------------------
Second Row
------------------------------------------------</fragment>
                                         </paragraph>
                                     </section>
The current code is below.
xsl:for-each select="RACE_LIST_HORSES/HORSE">
                            <section
startonnewpage="false" pagesize="a5" leftmargin="1cm"
rightmargin="1cm" topmargin="1cm" bottommargin="1cm">
     
                            </section>
                  
                        </xsl:for-each>
 

Here is the pseudocode for what I need implemented... 

 

<xsl:for-each select="RACE_LIST_HORSES/HORSE">
                            <section
startonnewpage="false" pagesize="a5" leftmargin="1cm"
rightmargin="1cm" topmargin="1cm" bottommargin="1cm">
           
<if current Record's value for
RACE_LIST_HORSES/HORSE/HORSE_FRONT_ROW_FLAG = 2>
       <if previous record's  if current Record's
value for RACE_LIST_HORSES/HORSE/HORSE_FRONT_ROW_FLAG
= 1>
         <section startonnewpage="false" pagesize="a5"
leftmargin="1cm" rightmargin="1cm" topmargin="1cm"
bottommargin="1cm">
                                         <paragraph
type="textparagraph" alignment="center">
                                             <fragment
font="Helvetica" fontsize="10">
------------------------------------------------
Second Row
------------------------------------------------</fragment>
                                         </paragraph>
                                     </section>
        <end if>
<end if>

                            </section>
                  
                        </xsl:for-each>

Current Thread