Hi,
The specification of xsl:message is soft, the instruction optional, and not
all processors support it. I suppose this softness is simply out of a
recognition that not all architectures are equally able to provide the
functionality.
A more conventionally XSLT-ish way to approach the problem would be to
define the error condition up front and simply design the stylesheet to
return warnings instead of (or in addition to) the usual thing, if any
error conditions obtain. So for example if I defined my condition as "all
<value> elements must have content that casts to a number" (so, for
example, "0" is okay but not just whitespace) and my input had (somewhere
inside)
<value>5</value>
<value>9</value>
<value></value>
<value>Hooey!</value>
my XSLT could have
<xsl:variable name="errors" select="//value(not(number(.))"/>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$errors">
<!-- erroneous 'value' elements are found -->
<xsl:apply-templates select="$errors" mode="report-errors"/>
</xsl:when>
<xsl:otherwise>
<!-- no errors: process normally -->
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
As noted above, you could leave out the xsl:choose and have the errors
reported in addition to, rather than instead of, normal output.
Note that this approach only works on "errors" that can be defined ahead
and that appear within otherwise proper well-formed XML.
Also, no "loop" is being "broken" -- no specification of flow of control is
really needed here, just a plain old declaration that "if X is true, I want
X', otherwise I want Y".
Cheers,
Wendell
At 03:20 PM 8/12/2005, you wrote:
Oleg,
I've never used Cocoon, but I can tell you that Xalan 2.5.1 and
above (2.7 was released a few days ago) do support the xsl:message
instruction.
Regards,
Kenneth
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--