xsl-list
[Top] [All Lists]

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

2007-05-10 07:29:12
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>

From what I've read you need to use preceding for the
previous record only, but I have no idea how to
implement it within the if statement.

Any help would be greatly appreciated

Send instant messages to your online friends http://au.messenger.yahoo.com 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>