Messages

The stylesheet is able to pass a message to the XSLT processor, which should provide some means to further pass on this message to the user, perhaps in a pop-up window or as output to the command line.

The Message element contains the XML fragment to be displayed. This element cannot be used at the top level of the stylesheet, only within templates and other structures.

Its most obvious purpose is to assist with debugging:

<template match="weird-element">
  <message>The WEIRD element has occurred</message>
  <html:P><apply-templates/></html:P>
</template>

Serious problems may require more drastic action than simply displaying a message. When reporting a serious error, it may be appropriate to halt the styling process as well. The Terminate ...

Get XML Companion, The, Third 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.