| Subject: xsl:message inside of xsl:variable From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 30 Jun 2000 11:24:15 +0200 (MET DST) | 
Hello,
take a look at the following template:
<xsl:template match="/">
   <xsl:variable name="message">
      <xsl:message>a message</xsl:message>
      <xsl:text>some text</xsl:text>
   </xsl:variable>
   <xsl:value-of select="$message" />
</xsl:template>
What is the expected output?
I tested this with Saxon, XT and LotusXSL/Xalan, and only Saxon seems
to do the job the way I wanted it:
a message
<?xml version="1.0" encoding="utf-8" ?>some text
I.e. "a message" is sent directly to the output (stderr), message contains
"some text".
XT and LotusXSL omit "a message".
I need this for the following kind of application.
The first step of my transformation is a check if the source document
is valid according to my constraints (of course I could separate the 
task using Schematron ...).
Every time an error is detected the stylesheet produces a message via
<xsl:message>. I want all errors to be found, and I want to stop if
one or more errors occured.
The solution I had was
<xsl:variable name="errors">
   <xsl:apply-templates mode="validate">
</xsl:variable>
<xsl:if test="string-length($errors)!=0">
   <xsl:message terminate="yes">
       <xsl:value-of select="string-length($errors)"/>
       <xsl:text> errors detected</xsl:text>
   </xsl:message>
</xsl:if>
If a template in validate mode detects an error it calls
<xsl:message>
   <xsl:text> ... error report ... </xsl:text>
</xsl:message>
<xsl:text>.</xsl:text>
That works great with Saxon! :-)
Unfortunately XT and LotusXSL omit all error reports. They just say (e.g.)
"5 errors detected", terminate, and that's all.
Is that a bug in XT and LotusXSL, or is the XSLT spec too unspecific?
Cheers,
Oliver
/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| RE: version on xsl:output, Kay Michael | Thread | Re: xsl:message inside of xsl:varia, Warren Hedley | 
| RE: version on xsl:output, Kay Michael | Date | RE: Scripts with Saxon, Kay Michael | 
| Month |