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

Variable scope issue.

Subject: Variable scope issue.
From: Nitin.Jain@xxxxxxxxxxxxxxx
Date: Fri, 8 Feb 2002 23:38:04 +0530
variable scope issue
Hi!

I will appritiate if anybody could spare some time and reply to this query.

The XML structure looks like:
<List>
     <reports>
          <Currency>CA</Currency>
          <ChequeDate>05-16-2001</ChequeDate>
          <DepositAmt>12.0</DepositAmt>
     </reports>
     <reports>
          <Currency>CA</Currency>
          <ChequeDate>05-16-2001</ChequeDate>
          <DepositAmt>14.0</DepositAmt>
     </reports>
     <reports>
          <Currency>CA</Currency>
          <ChequeDate>05-20-2001</ChequeDate>
          <DepositAmt>18.0</DepositAmt>
     </reports>
     <reports>
          <Currency>CA</Currency>
          <ChequeDate>05-20-2001</ChequeDate>
          <DepositAmt>16.0</DepositAmt>
     </reports>
     <reports>
          <Currency>US</Currency>
          <ChequeDate>05-16-2001</ChequeDate>
          <DepositAmt>12.0</DepositAmt>
     </reports>
     <reports>
          <Currency>US</Currency>
          <ChequeDate>05-16-2001</ChequeDate>
          <DepositAmt>14.0</DepositAmt>
     </reports>
</List>

And the requirement is to generate the report like this:

Currency: CA
Date      Amount
05-16-2001     12.0
05-16-2001     14.0
SubTotal  26.0

Date      Amount
05-20-2001     18.0
05-20-2001     16.0
SubTotal  34.0
Total          60.0

Currency: US
Date      Amount
05-16-2001     12.0
05-16-2001     14.0
SubTotal  26.0
Total          26.0

The XML data is presorted.( wrt currency type and date )

So for this I have a subTotal variable which I declared before the
template. And when I loop within reports, after printing the first subTotal
correctly in the second (and subsequent) subTotals it prints incorrect
values.
And the reason is that I try to reset the variable to zero when a new date
entry is found. But to my surprise the variable is not resseted.

Please suggest what is a workaround.

Thanks and Regards,
Nitin Jain


 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.