Exit in XSLT: was jumps (gotos....) in xslt

Subject: Exit in XSLT: was jumps (gotos....) in xslt
From: "Smith, Brian BC " <BS185791@xxxxxxxxxxxxxxxx>
Date: Mon, 28 Jun 1999 08:26:09 -0500
Thanks for this reply.  I believe the syntax you are speaking of is now
xsl:call-templates and 
xsl:templates.  I am already using templatees, but this by itself dones not
solve the problem.  
However, in your example you
had an "Exit" statement.  this is exactly what I need, but it is not part of
the XSLT specification.
But I see nothing in the XLST spec for early termination.  I believe early
termination would be
a side-effect and therefore would not be allowed.  Is this correct?

So my question is can I end XSLT processing via an Exit statement of some
type?  Failing this
I still need a jump.  The call-templates return to the original line (method
call syntax).  and what
I need is something that does not return to original line.

Brian Smith

>It has been a while since I did anything with XSLT, but if I recall you
>might get some use out of xsl:invoke (for all I know the name of the tag
>may of changed) where you can in a sense "goto" a stylesheet defined
>macro.  So you could have:
>  <!-- Error -->
>  <xsl:when test="foo">
>    <xsl:invoke macro="End">
>    <xsl:invoke>
>  </xsl:when>
><xsl:macro name="End">
>  Exit
>Forgive me if I am wrong on the actual syntax as I have not had much to do
>with XSL for about 6 months now.  Just trying to help.

>"Smith BC (Brian) at MSXSSC" wrote:
>> I have been using the XSL:choose for a while now and I find that I have
>> some complex nesting going on.   In some situations I would dearly
>> love to have a goto ID where the ID is used to identifier a jump point
>> with the XSL file (not the XML source).  I am aware that goto's are
>> usually not good form.  However, the classic "if error goto end" is
>> an example of where the goto is usually approved of, and I need it
>> for something similiar.
>> Has anyone else been frustrated with complex nesting within XSLT?
>> If so, are there any options?  I have switched to an XSLT processor
>> so I can now use call-templates.  This helps improves clarity a great
>> deal, but it does not address the root of the problem.
>> Brian Smith
>> Shell Services International

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

Current Thread