Re: [xsl] Where does <xsl:message> output go?

Subject: Re: [xsl] Where does <xsl:message> output go?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 07 Apr 2010 10:12:33 -0400
At 2010-04-07 10:06 -0400, Costello, Roger L. wrote:
I know that when I run an XSLT transform from the DOS command line, the contents of <xsl:message> goes to the command line.

Sounds like you are using Saxon and it is actually going to the error port. You can redirect it with:


2>filename

If I invoke an XSLT transform using, say, a Java program, where does the <xsl:message> content go? If there are multiple <xsl:message> elements, does their content all go to the same place? Where?

It is implementation defined. The spec doesn't say where they go at all:


  http://www.w3.org/TR/2007/REC-xslt20-20070123/#message
  "The xsl:message instruction sends a message in an
   implementation-defined way."

Is it the same for every XSLT processor?

Not at all. Saxon puts them to the error port. IE ignores all except those with terminate="yes". And even then I think IE truncates a long message.


What happens to the in-memory result tree when the XSLT processor encounters an <xsl:message terminate="yes"> element?

It is the same as a dynamic error:


  When a transformation is terminated by use of xsl:message
  terminate="yes", the effect is the same as when a
  non-recoverable dynamic error occurs during the transformation.

I've found sometimes that if I've finished off the result tree document element and then run terminate="yes" that the file is okay, but I can't rely on that.

I hope this helps.

. . . . . . . . . . Ken

--
XSLT/XQuery training:         San Carlos, California 2010-04-26/30
Principles of XSLT for XQuery Writers: San Francisco,CA 2010-05-03
XSLT/XQuery training:                 Ottawa, Canada 2010-05-10/14
XSLT/XQuery/UBL/Code List training: Trondheim,Norway 2010-06-02/11
Vote for your XML training:   http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread