[jdom-interest] JDOM Multiple file output from XSLT.

Mark.Winney at metavante.com Mark.Winney at metavante.com
Wed Aug 6 10:29:51 PDT 2003


I have a java program that runs an XSLT program against some XML and 
outputs the resulting XML to file using the XMLOutputter.  See below.

    FileOutputStream fileOS = null;
    File outFile = new File(fName);
    fileOS = new FileOutputStream(outFile);
 
    StringBufferInputStream docStream = new 
StringBufferInputStream(outXML);
 
    SAXBuilder builder = new SAXBuilder();
    Document doc = builder.build(docStream);
 
    Transformer transformer = TransformerFactory.newInstance()
                .newTransformer(new StreamSource(FilePaths.MAN_XML_PATH + 
strTransformProg));
 
    JDOMSource source = new JDOMSource(doc);
    JDOMResult result = new JDOMResult();
 
    transformer.transform(source, result);
    Document doc2 = result.getDocument();
 
    XMLOutputter outp = new XMLOutputter();
    outp.setTextNormalize(true);
    outp.setIndent("  ");
    outp.setNewlines(true);
    outp.output(doc2, fileOS);
 
    fileOS.close();


What I also want is the XSL to generate multiple output files also by 
doing the following:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.1">
        <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
        <xsl:strip-space elements="*"/>
        <!-- ROOT LEVEL OF THE FILE HIERARCHY -->
        <xsl:template match="APP_FILE">
                <xsl:element name="My-XML">
                        <xsl:document href="my_try.html" method="html">
                                <html><body></body></html>
                        </xsl:document>
                </xsl:element>
        </xsl:template>
</xsl:transform>

What happens is that the XML document my_try.html is not generated and the 
html ends up in the xml document specified by the java XMLOutputter.
Is it possible to have the xsl also create multiple output files?

Thanks
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20030806/8f6c90f5/attachment.htm


More information about the jdom-interest mailing list