Skip to content

xsl:message

Emits a diagnostic message during transformation. Can optionally terminate the transformation.

<xsl:message>processing item <xsl:value-of select="@id"/></xsl:message>

Messages go to the message handler configured in the API (or to stderr by default in the CLI). With terminate="yes", the message is followed by halting the transformation with an error.

Per the XSLT 3.0 spec, dynamic errors that occur while evaluating the body of a non-terminating xsl:message do not cause the transformation to fail — they are silently dropped.

Attributes

Attribute Description
select XPath expression for the message text.
terminate yes to halt the transformation after the message; no (default) to continue. AVT.
error-code Optional error code QName when terminating.

Examples

Conditional warning:

<xsl:if test="not(title)">
  <xsl:message>warning: missing title in <xsl:value-of select="@id"/></xsl:message>
</xsl:if>

Fatal error:

<xsl:message terminate="yes">unsupported version: <xsl:value-of select="@version"/></xsl:message>