How do I access message from <xsl:message> in camel-xslt
Issue
I'm using
<xsl:message terminate="yes">
to terminate the processing of some xsl stylesheets. The message I put into the
For instance, here is my xslt stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="* | /">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="age">
<xsl:choose>
<xsl:when test="number(.) > 17">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
<xsl:text>WARN: the person '</xsl:text>
<xsl:value-of select="/person/name"/>
<xsl:text>' is under 18! age='</xsl:text>
<xsl:value-of select="/person/age"/>
<xsl:text>'</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="text() | @*">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
The following XML will cause the stylesheet to terminate and a warning message to be printed out to the log:
<?xml version="1.0" encoding="UTF-8"?>
<person>
<name>Jack</name>
<age>17</age>
</person>
Environment
- JBoss Fuse 6.0;
- JBoss Fuse 6.1;
- Apache Camel 2.12.x;
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.