xsl-list
[Top] [All Lists]

RE: Need Help with XSL loop break logic

2003-08-07 07:51:48
Is the issue that you are using a foreach and want to break out of the foreach?

If so, you have two options (that immediately come to mind) available to you:

- Don't use a for-each, but use a recursive named template, which you can 
easily break out of
- Have logic in your foreach to emit something when certain conditions are met 
and not when they are not met

I cannot say that I completely understand your problem or problem space, so 
this may not help, but it seems like it might.

Thanks,

Rich

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Sonu
Sent: Wednesday, August 06, 2003 4:09 PM
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Need Help with XSL loop break logic

Hello XSL gurus,

I am in the process of generating a complex PDF report using XSLFO and seem to 
be stuck between a rock and hard place - my brain is totally fried after 3 days 
of trying now.

Consider the case of an invoice with 2 types of products (say product1 and 
product2). If the merchant deals in only one type (either product1 or product2 
only), I have to display only one summary page with his product header + 
contents and the detail page with the same product header and all the line 
items. 

The condition is that if the dealer deals in both the products and has ordered 
both the products, I have to show him 2 summary pages (one for each product 
with appropriate product headers) and then the all the line items for that 
invoice. The line item page might be more than 10 pages long and will overflow.

Report Type 1 :
Dealer dealing in 2 products and having an invoice with both products (meaning 
he has ordered some amounts of both products):
        Produt1Header + Product1Summary
        Product2Header + Product2Summary
        Product1Andproduct2Header + Detail line items (can span multiple pages)

Report Type 2 :
Dealer dealing in 2 products and having an invoice with either one of 2 
products :
        Produt1Header OR Product2Header + Product1Summary OR Product2Summary
        Product1Header OR Product2Header + Detail line items of Product1 or 
Product2(can span multiple pages)
        
Report Type 3 : 
Dealer dealing in 1 product only and having an invoice with 1 product :
        Produt1Header + Product1Summary
        Product1Header + Detail line items (can span multiple
pages)

Since my report depends on the data that I receive from the XML, I need a 
condition in my XSL to break the loop after printing the first two summary 
pages (if there are any) and keep printing the detail line item pages 
repeatedly. I have tried everything in XSL but am not able to set any condition 
where I can print certain pages only once and print multiple for all other 
pages...

Can anyone please suggest a way out of this problem ??
Please email me if I am not clear in explaining the problem..

Thanks a lot,
Sonu

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software 
http://sitebuilder.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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