xml - Using Transformer in java for multiple outputs from an XSLT? -
i'm trying code call in xml file , xsl - perform transformation , output multiple outcome files depending on xml content.
import javax.xml.transform.*; import javax.xml.transform.stream.streamresult; import javax.xml.transform.stream.streamsource; import java.io.file; import java.io.ioexception; import java.net.urisyntaxexception; public class testtransformation { public static void main(string[] args) throws transformerexception { system.setproperty("javax.xml.transform.transformerfactory","net.sf.saxon.transformerfactoryimpl"); transformerfactory tfactory = transformerfactory.newinstance(); source xslt = new streamsource(new file("transformer.xslt")); transformer transformer = tfactory.newtransformer(xslt); source xmltext = new streamsource(new file("data.xml")); transformer.transform(xmltext, new streamresult(new file("output.xml")));
but want transform produce multiple output files.. ideas appreciated!!
i want transform produce multiple output files.
you in xslt stylesheet itself: http://www.w3.org/tr/xslt20/#result-trees
this assuming indeed using xslt 2.0 processor. in xslt 1.0, can use exslt extension: http://exslt.org/exsl/elements/document/index.html instead - provided processor supports it.
Comments
Post a Comment