Name
<xsl:message>
Sends a message. How the message is sent can vary from one XSLT processor to the next, but it’s typically written to the standard output device. This element is useful for debugging stylesheets.
Category
Instruction.
Required Attributes
None.
Optional Attributes
terminate
If this attribute has the value
yes
, the XSLT processor stops execution after issuing this message. The default value for this attribute isno
; if the<xsl:message>
doesn’t terminate the processor, the message is sent and processing continues.[2.0] In XSLT 2.0, the value of the
terminate
attribute can be an attribute value template, allowing its value to be calculated at runtime.- [2.0]
select
An XPath expression that defines the content of this message.
Content
An XSLT template.
Appears in
<xsl:message>
appears
inside a template.
Defined in
[1.0] XSLT section 13, “Messages.”
[2.0] XSLT section 17, “Messages.”
Example
Here’s a stylesheet that uses the <xsl:message>
element to trace the
transformation of an XML document. We’ll use our list of recently
purchased albums again:
<?xml version="1.0"?>
<!-- albums.xml -->
<list xml:lang="en">
<title>Albums I've bought recently:</title>
<listitem>The Sacred Art of Dub</listitem>
<listitem>Only the Poor Man Feel It</listitem>
<listitem>Excitable Boy</listitem>
<listitem xml:lang="sw">Aki Special</listitem>
<listitem xml:lang="en-gb">Combat Rock</listitem>
<listitem xml:lang="zu">Talking Timbuktu</listitem>
<listitem xml:lang="jz">The Birth of the Cool</listitem>
</list>
Get XSLT, 2nd Edition 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.