Exception durin processing XSLT transformation!

Posted by Artic on Stack Overflow See other posts from Stack Overflow or by Artic
Published on 2010-03-19T17:58:42Z Indexed on 2010/03/19 18:01 UTC
Read the original article Hit count: 239

Filed under:
|
|

I'm usin such code to generate contents file.

try {
        StreamResult result = new StreamResult();
        TransformerFactory tf = TransformerFactory.newInstance();
        for (String item: groups){
            item = item.replaceAll(" ", "-").toLowerCase();
            result.setOutputStream(new FileOutputStream(path+item+".html"));
            Templates templ =  tf.newTemplates(xsltSource);
            Transformer transf = templ.newTransformer();
            transf.clearParameters();
            transf.setParameter("group", item);
            transf.transform(xmlSource, result);
        }
    } catch (TransformerConfigurationException e) {
    throw new SinkException(e.getMessage());
    } catch (TransformerException e) {
    throw new SinkException(e.getMessage());
    }

But on second iteration I have an exception

ERROR: javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Read error

Cann't understand what is the reason?

© Stack Overflow or respective owner

Related posts about java

Related posts about xslt