title: Capture xsl:message output in java
body: <p>I'm trying to capture xsl:message in java when calling my transform.  Below is a snippet of my code.</p>
  
  <pre><code>        final ArrayList&lt;TransformerException&gt; errorList = new ArrayList&lt;TransformerException&gt;();
          ErrorListener errorListener = new ErrorListener() {
            @Override
            public void warning(TransformerException e) throws TransformerException {
              //To change body of implemented methods use File | Settings | File Templates.
              log.error(e.getMessage());
              errorList.add(e);
            }
  
            @Override
            public void error(TransformerException e) throws TransformerException {
              //To change body of implemented methods use File | Settings | File Templates.
              log.error(e.getMessage());
              errorList.add(e);
            }
  
            @Override
            public void fatalError(TransformerException e) throws TransformerException {
              //To change body of implemented methods use File | Settings | File Templates.
              errorList.add(e);
              throw e;
            }
        };
        ...
        try
        {
          transformer.setErrorListener(errorListener);
          newDoc = transform(transformer, oldDoc);
        }
        catch (TransformerException e) {
          log.error("Problem transforming normalized document into PUBS-XML", e);
          throw e;
        }
  </code></pre>
  
  <p>Unfortunately this is not working.</p>
  
  <p>Is there a better way?</p>
  
  <p>Thanks in advance!</p>