You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by André Mercadier <an...@laposte.net> on 2006/10/28 10:22:51 UTC

How to avoid instruction prints stylesheet file informations ?

Hello,

I'm using Xalan 2.7.0 with Xerces 2.7.1 on a MS-DOS environment with the command line utility to perform XSLT transformations (java org.apache.xalan.xslt.Process -IN foo.xml -XSL foo.xsl -OUT foo.out -PARAM param value).

My foo.xsl stylesheet contains several <xsl:message>STEP xxx</xsl:message> to trace the steps it reaches, but the printed message is not only "STEP xxx" but :

"file:///c:/my_very_complex_directory/foo.xsl ; Line x; Column y; STEP xxx".

Is it possible to avoid the stylesheet file informations (which don't interest users), keeping only the message in the <xsl:message> tag ?

Thanks a lot.

Re: How to avoid instruction prints stylesheet file informations ?

Posted by Erin Harris <eh...@ca.ibm.com>.
Hi André,

You could write your own error listener such as the following:

        public class MyErrorListener implements ErrorListener {
                public void warning(TransformerException exception) throws 
TransformerException {
                        System.err.println(exception.getMessage());
                }

                public void error(TransformerException exception) throws 
TransformerException {
 System.err.println(exception.getMessageAndLocation());
                }

                public void fatalError(TransformerException exception) 
throws TransformerException {
 System.err.println(exception.getMessageAndLocation());
                }
        }

To set the error listener on the transformer use the method: 
Transformer.setErrorListener(ErrorListener)

Thanks.

Erin Harris





André Mercadier <an...@laposte.net> 
28/10/2006 04:22 AM

To
<xa...@xml.apache.org>
cc

Subject
How to avoid <xsl:message> instruction prints stylesheet file informations 
?






Hello,
 
I'm using Xalan 2.7.0 with Xerces 2.7.1 on a MS-DOS environment with the 
command line utility to perform XSLT transformations (java 
org.apache.xalan.xslt.Process -IN foo.xml -XSL foo.xsl -OUT foo.out -PARAM 
param value).
 
My foo.xsl stylesheet contains several <xsl:message>STEP xxx</xsl:message> 
to trace the steps it reaches, but the printed message is not only "STEP 
xxx" but :
 
"file:///c:/my_very_complex_directory/foo.xsl ; Line x; Column y; STEP xxx
".
 
Is it possible to avoid the stylesheet file informations (which don't 
interest users), keeping only the message in the <xsl:message> tag ?
 
Thanks a lot.