Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

XSLT <xsl:message> elemens


May 28, 2021 XSL T


Table of contents


XSLT and lt;xsl: messages and elements

You can report related errors through the XSLT-lt;xsl:message> element.


XSLT <xsl:message> elemens Complete XSLT element reference manual

Definitions and usages

The element writes a message to the output. This element is primarily used to report errors.

This element can contain almost any other XSL element .

The terminate property allows you to choose whether to exit processing or continue processing when an error occurs.


Grammar

<xsl:message terminate="yes|no">

<!-- Content:template -->

</xsl:message>

Property

Attributes value describe
terminate yes
no
Optional."YES": After the message is written, terminate it."NO": Continue processing after the message is written.The default is "no".

Instance 1

Detects whether the artist is an empty string. If so, exit the XSL processor and display a message:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<body>
<xsl:for-each select="catalog/cd">
<p>Title: <xsl:value-of select="title"/><br />
Artist:
<xsl:if test="artist=''">
<xsl:message terminate="yes">
Error: Artist is an empty string!
</xsl:message>
</xsl:if>
<xsl:value-of select="artist"/>
</p>
</xsl:for-each>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

XSLT <xsl:message> elemens Complete XSLT element reference manual