xsl:message

The xsl:message element causes a message to be displayed. The message is the contents of the xsl:message element.

There is an optional attribute terminate with permitted values yes and no; the default is no. If the value is set to yes, processing of the stylesheet is terminated after issuing the message. This attribute may be supplied as an attribute value template.

By default the message is displayed on the standard error output stream. You can supply your own message Emitter if you want it handled differently. This must be a class that implements the net.sf.saxon.output.Emitter interface. The content of the message is in general an XML fragment. You can supply the emitter using the -m option on the command line, or the setMessageEmitter() method of the Controller class.

No newline is added to the message that is passed to the message emitter. The default message emitter adds a newline itself. If you want to be sure of getting a newline, add one from the application, as shown below.

Example: This example displays an error message.

<xsl:template match="BOOK">
        <xsl:if test="not(@AUTHOR)">
            <xsl:message>Error: BOOK found with no AUTHOR!&#xa;</xsl:message>
        </xsl:if>
    ...
    </xsl:template>

Expand

Next