  | |  | How to avoid <xsl:message > instruction prints stylesheet file informations ? | How to avoid <xsl:message > instruction prints stylesheet file informations ? 2006-10-30 - By Erin Harris
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 <andre.mercadier@(protected)> 28/10/2006 04:22 AM
To <xalan-j-users@(protected)> 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.
<br><font size=2 face="sans-serif">Hi André,</font> <br> <br><font size=2 face="sans-serif">You could write your own error listener such as the following:</font> <br> <br><font size=2 face="Courier"> public class MyErrorListener implements ErrorListener {</font> <br><font size=2 face="Courier"> public void warning(TransformerException exception) throws TransformerException {</font> <br><font size=2 face="Courier"> System.err.println(exception .getMessage());</font> <br><font size=2 face="Courier"> }</font> <br> <br><font size=2 face="Courier"> public void error(TransformerException exception) throws TransformerException {</font> <br><font size=2 face="Courier"> System.err.println(exception .getMessageAndLocation());</font> <br><font size=2 face="Courier"> }</font> <br> <br><font size=2 face="Courier"> public void fatalError(TransformerException exception) throws TransformerException {</font> <br><font size=2 face="Courier"> System.err.println(exception .getMessageAndLocation());</font> <br><font size=2 face="Courier"> }</font> <br><font size=2 face="Courier"> }</font> <br> <br><font size=2 face="sans-serif">To set the error listener on the transformer use the method: </font><font size=2 face="Courier">Transformer.setErrorListener (ErrorListener)</font> <br> <br><font size=2 face="sans-serif">Thanks.<br> <br> Erin Harris<br> <br> </font> <br> <br> <br> <table width=100%> <tr valign=top> <td width=40%><font size=1 face="sans-serif"><b>André Mercadier <andre .mercadier@(protected)></b> </font> <p><font size=1 face="sans-serif">28/10/2006 04:22 AM</font> <td width=59%> <table width=100%> <tr valign=top> <td> <div align=right><font size=1 face="sans-serif">To</font></div> <td><font size=1 face="sans-serif"><xalan-j-users@(protected)></font> <tr valign=top> <td> <div align=right><font size=1 face="sans-serif">cc</font></div> <td> <tr valign=top> <td> <div align=right><font size=1 face="sans-serif">Subject</font></div> <td><font size=1 face="sans-serif">How to avoid <xsl:message> instruction prints stylesheet file informations ?</font></table> <br> <table> <tr valign=top> <td> <td></table> <br></table> <br> <br> <br><font size=2 face="Arial">Hello,</font> <br><font size=2 face="Arial"> </font> <br><font size=2 face="Arial">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).</font> <br><font size=2 face="Arial"> </font> <br><font size=2 face="Arial">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 :</font> <br><font size=2 face="Arial"> </font> <br><font size=2 face="Arial">"</font><a href="file:///c:/my_very_complex _directory/foo.xsl%20;%20Line%20x;%20Column%20y;%20STEP%20xxx" target=_blank> <font size=2 face="Arial"><u>file:///c:/my_very_complex_directory/foo.xsl ; Line x; Column y; STEP xxx</u></font></a><font size=2 face="Arial">".< /font> <br><font size=2 face="Arial"> </font> <br><font size=2 face="Arial">Is it possible to avoid the stylesheet file informations (which don't interest users), keeping only the message in the <xsl:message> tag ?</font> <br><font size=2 face="Arial"> </font> <br><font size=2 face="Arial">Thanks a lot.</font> <br>
|
|
 |