The <xsl:message> Element

You can use the <xsl:message> element to cause the XSLT processor to display a message, and, optionally, quit processing a stylesheet. The <xsl:message> element has one attribute:

  • terminate (optional). Set to “yes” to terminate processing. The default is “no”.

Where the message is actually sent depends on the XSLT processor. For Java-based XSLT processors, the message is usually sent to the Java error output stream, which corresponds to the screen if you invoke the XSLT processor on the command line. Other XSLT processors may display messages in pop-up windows, or in Web pages sent to browsers.

Here’s an example. In this case, I’ll terminate XSLT processing when the XSLT processor tries to transform a <DAY> element ...

Get Inside XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.