Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2009, 02:23 AM
Registered User
 
Join Date: Nov 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Style Sheet exit

Hi all,

I have a one problem in xsl.

I dont want to do further execution, when a condition reaches. I need to come out from the style sheet. Could you any one help me out on this.

Thanks,
Veera
 
Old November 9th, 2009, 05:34 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If you want to abort the transformation you can do xsl:message terminate="yes". But if you want to finish cleanly, with a usable transformation result, then you are thinking about it the wrong way. The clue is your use of "when". Don't think of XSLT transformation as a sequence of operations happening in a particular order, it's not that kind of language. Think declaratively: you need to express the output as a function of the input.

To help you put that into practice, I would need to know more about what your transformation is doing.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old November 9th, 2009, 06:02 AM
Registered User
 
Join Date: Nov 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Mhkay,

Thanks for useful reply,

My xslt transforms xml to fixed messages. I got a requirement if condition satsifies then generate the flat file till part of the XSLT means it doesnt continue to generate flat message for further code, it has to generate till this condition checking. otherwise it has to generate, whatever we have coded.

Thanks,
Veera
 
Old November 9th, 2009, 07:04 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

So you want to transform the part of the input up to the first item that matches some condition C.

So find the first item that matches C:

Code:
<xsl:variable name="finalItem" select="/*/item[C][1]"/>
and then transform everything that comes before this item:

Code:
<xsl:apply-templates select="$finalItem/preceding-sibling::*"/>
Of course that's just a sketch, you'll have to adapt it to your actual input.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to redirect XML outputted by style sheet back into same style sheet Kenneth.Dougherty XSLT 4 November 9th, 2009 04:29 PM
Setting the style sheet of the Master Page dotnetDeveloper BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 August 4th, 2008 09:56 AM
Chapter 2 -- Style Sheet problem. Doug Happ BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 4 January 10th, 2008 01:14 PM
cascading style sheet problem nikotromus ASP.NET 2.0 Professional 0 March 24th, 2006 07:49 PM
Setting the Style Sheet class jacob ASP.NET 1.0 and 1.1 Basics 4 August 20th, 2003 01:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.