[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] user error


Subject: Re: [xsl] user error
From: Mike Sokolov <sokolov@xxxxxxxxxxxx>
Date: Thu, 10 Sep 2009 14:55:13 -0400

Thanks! That's exactly what I was looking for. I like the syntax better than the XPath version, although it's also worth noting the differences between the output generated by the two methods. Using Saxon, at least: the XPath error() generates a stack trace, which may be helpful, wheras xslt:message seems to rely on the stylesheet writer to generate whatever contextual info is required.

-Mike


G. Ken Holman wrote:
At 2009-09-10 14:00 -0400, Mike Sokolov wrote:
Is there a recognized idiom for throwing an exception in XSLT that would abort processing and pass the error state (message, at least) to the invoker of the transformation?
It looks to me as if this can be achieved using the XPath error() function, but I'm just wondering how folks would typically invoke that.
Using <xsl:value-of select="error()" /> seems like the most unobtrusive, but I wonder if there is some built-in XSLTism for this.

Review <xsl:message terminate="yes"> for what you need.


I hope this helps.

. . . . . . . . . Ken


-- Interested in these classes? http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal


Current Thread
Keywords