Re: [xsl] Evaluating a return value or throwing an exception

Subject: Re: [xsl] Evaluating a return value or throwing an exception
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Fri, 25 May 2007 09:56:12 +0100
On 5/25/07, didis5@xxxxxx <didis5@xxxxxx> wrote:
Sorry, I posted the question below from another account and I don't know if it will be read cause I registered this email address. So this is a copy of my former email.
--------------------------------
Hello,

I want to cancle an xslt-Transformation, if a condition is fulfilled. This condition I can evaluate at runtime, when executing the xsl-script.
With xsl:message I can rise a message, but I want to evaluate the response in the java code, cause the result of the transformation is not important, if the condition is not fulfilled.

So I need a return value or an exception, so that I can see outside of the transformation, that it was canceled.

Is there a possibility to set a parameter in the script, which can be accessed from outside or is there a possibility to throw an exception in the script?

Im using Java, Xalan-J-2.7.0

You could just write your XSLT to finish if the condition is met, returning a value in the result that you check for eg:

<xsl:choose>
 <xsl:when test="condition is met">false</when>
 <xsl:otherwise> continue processing .... </xsl:otherwise>

If the result of the transform is "false" then you know the condition was met.

cheers
andrew

Current Thread