obteniendo una excepción al hacer la transformación xslt a través de java [duplicado]

Esta pregunta es un duplicado exacto de:

obteniendo error en la transformación xslt a través de java 1 respuesta

Tengo la clase java a continuación en la que estoy usando xstream rite ahora, como puedes ver que en la clase java a continuación estoy generando xml a partir del objeto

InvoiceReferenceNotificationMessage invoiceReferenceNotificationMessage = new InvoiceReferenceNotificationMessage();
        invoiceReferenceNotificationMessage.setInvoiceReference("SM/829709/0315");
        invoiceReferenceNotificationMessage.setABSReference("IRMAR157311");
        invoiceReferenceNotificationMessage.setCurrency("GBP");
        invoiceReferenceNotificationMessage.setInvoiceAmount(2546);
        invoiceReferenceNotificationMessage.setPaidAmount(1245);
        invoiceReferenceNotificationMessage.setBalanceAmount(0);
        invoiceReferenceNotificationMessage.setValueDate(new Date());
        invoiceReferenceNotificationMessage.setRemarks("abc");


        InvoiceReferenceNotificationMessage invoiceReferenceNotificationMessage1 = new InvoiceReferenceNotificationMessage();
        invoiceReferenceNotificationMessage1.setInvoiceReference("SM/15");
        invoiceReferenceNotificationMessage1.setABSReference("I157311");
        invoiceReferenceNotificationMessage1.setCurrency("EUR");
        invoiceReferenceNotificationMessage1.setInvoiceAmount(255546);
        invoiceReferenceNotificationMessage1.setPaidAmount(125545);
        invoiceReferenceNotificationMessage1.setBalanceAmount(0);
        invoiceReferenceNotificationMessage1.setValueDate(new Date());
        invoiceReferenceNotificationMessage1.setRemarks("abERRc");


        Mail m = new Mail();
        String xslFilePath1 = "C:\\xsl\\rok.xsl";

        m.setInvoiceReferenceNotificationMessage(invoiceReferenceNotificationMessage);
        XStream xstream = new XStream();
        xstream.alias("arokermail",Mail.class);
        String abc = xstream.toXML(m);


        m.setInvoiceReferenceNotificationMessage(invoiceReferenceNotificationMessage1);
        xstream.alias("arokermail",Mail.class);
        String def = xstream.toXML(m);

        String t =abc+def;

entonces el código anterior genera el siguiente xml

        <arokermail>
  <invoiceReferenceNotificationMessage>
    <InvoiceReference>SM/829709/0315</InvoiceReference>
    <ABSReference>IRMAR157311</ABSReference>
    <Currency>GBP</Currency>
    <InvoiceAmount>2546.0</InvoiceAmount>
    <PaidAmount>1245.0</PaidAmount>
    <BalanceAmount>0.0</BalanceAmount>
    <ValueDate>2015-05-22 15:44:14.741 IST</ValueDate>
    <Remarks>abc</Remarks>
  </invoiceReferenceNotificationMessage>
</arokermail><arokermail>
  <invoiceReferenceNotificationMessage>
    <InvoiceReference>SM/15</InvoiceReference>
    <ABSReference>I157311</ABSReference>
    <Currency>EUR</Currency>
    <InvoiceAmount>255546.0</InvoiceAmount>
    <PaidAmount>125545.0</PaidAmount>
    <BalanceAmount>0.0</BalanceAmount>
    <ValueDate>2015-05-22 15:44:14.741 IST</ValueDate>
    <Remarks>abERRc</Remarks>
  </invoiceReferenceNotificationMessage>
</arokermail>

ahora también he creado un xsl que he almacenado en mi computadora llamado rok.xsl que quiero aplicar en el xml generado como parte de la transformación xsl, por lo que el siguiente xsl lo he almacenado en una variable como se muestra a continuación.

String xslFilePath1 = "C:\\xsl\\rok.xsl";

ahora, por favor, indique cómo aplicar este xsl en el xml generado, el xml generado se almacena en una variable de cadena llamada t;

String t =abc+def;

a continuación es lo que he intentado llamando a una función y pasando parámetros

String t =abc+def; //generated xml
    String xslFilePath1 = "C:\\xsl\\rok.xsl";";
    String outputhtml =null;

    try
        {
            st.transform(t, xslFilePath1, outputhtml);
            }
    catch (TransformerConfigurationException e)
                {
                    System.err.println("TransformerConfigurationException");
                    System.err.println(e);
                }
                catch (TransformerException e)
                {
                    System.err.println("TransformerException");
                    System.err.println(e);
                }

y la función que se llama se muestra a continuación

public void transform(String dataXML, String inputXSL, String outputHTML)
                throws TransformerConfigurationException, TransformerException

        {
         TransformerFactory factory = TransformerFactory.newInstance();
            StreamSource xslStream = new StreamSource(inputXSL);
            Transformer transformer = factory.newTransformer(xslStream);
           StreamSource in = new StreamSource(dataXML);
            StreamResult out = new StreamResult(outputHTML);
            transformer.transform(in, out);
            System.out.println("The generated HTML file is:" + outputHTML);

        }






the error that i am getting is ..




    TransformerException
    javax.xml.transform.TransformerException: Result object passed to ''{0}'' is invalid.

He actualizado el xsl para que mi rok.xsl se muestre a continuación.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="/">
        <html>
            <body>
                Hello,
                <br>
                </br>
                <br>
                </br>
                Please be advised of the following payment details
                    <font color="black" face="Arial" size="2" >
                    <br>
                        <br>

                            <table border="1" cellpadding="3" cellspacing="0">
                                <tr bgcolor="lightblue">
                                     <td nowrap="nowrap">Invoice Reference</td>
                                     <td nowrap="nowrap">ABSReference</td>
                                     <td nowrap="nowrap">Currency</td>
                                     <td nowrap="nowrap">Invoice Amount</td>
                                     <td nowrap="nowrap">Paid Amount</td>
                                     <td nowrap="nowrap">Balance Amount</td>
                                     <td nowrap="nowrap">Value Date</td>
                                     <td nowrap="nowrap">Remarks</td>

                                </tr>
                                <xsl:for-each select="arokermail/invoiceReferenceNotificationMessage">
                                    <tr>
                                        <td nowrap="nowrap"><xsl:value-of select="InvoiceReference" /></td>
                                        <td nowrap="nowrap"><xsl:value-of select="ABSReference" /></td>
                                        <td nowrap="nowrap"><xsl:value-of select="Currency" /></td>
                                        <td nowrap="nowrap"><xsl:value-of select="InvoiceAmount" /></td>
                                        <td nowrap="nowrap"><xsl:value-of select="PaidAmount" /></td>
                                        <td nowrap="nowrap"><xsl:value-of select="BalanceAmount" /></td>
                                        <td nowrap="nowrap"><xsl:value-of select="ValueDate" /></td>
                                        <td nowrap="nowrap"><xsl:value-of select="Remarks" /></td>
                                        </tr>
                                </xsl:for-each>
                                <TR>

                                </TR>
                            </table>
                        </br>
                    </br>
                    <p>

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
</br>
</br>                                   
</p>
                </font>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>