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

Breaking from the loop (for-each or apply-template)

Subject: Breaking from the loop (for-each or apply-template)
From: Oleg Konovalov <olegkon@xxxxxxxxx>
Date: Fri, 12 Aug 2005 11:05:28 -0400
breaking a for loop
Hi,

I am trying to fix bug in Cocoon [2.0.4] app and XSL1.0.
XSSF transformer reads Excel XLS file and then we insert the
data intothe database table using SQLTransformer.
This particular date column is NOT nullable, so now it now
populates it with trunc(sysdate) if the data in XSL is in wrong
format or the cell is not of DATE type.

But that Date is extremely important to business, so what I am
trying to do is to break out of creating insert and show the
user an error message to fix XLS file.

I am inside the for-each loop (going through cells in row)
before building a query to be executed by  SQL transformer.
That row processing is triggered by apply-template (so that's like in
another loop).
I am trying to break out of the loop like:
using redirect to "my_url?error=1", and on that form I try to
handle that error but for some reason it's not redirecting.
<xsl:for-each select='$row/sht:Cell'>
 <xsl:if test="not(@ValueType='DATE') and contains(sht:Name,
'Start_Date')">
   <redirect
xmlns="http://mycompany.com/redirect/1.0">upload_mbr_form?error=1</redirect>
 </xsl:if>
</xsl:for-each>

So how do I break from apply-template and for-each loop ?

Also tried to populate that DB column with null to create SQL
exception
and than put xsl handle-error block in the pipeline in XMAP,
but that still doesn't resirect to an error page.

Any suggestions ?


Thank you in advance,
Oleg.

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.