I have the following Java Program:\[code\]import javax.xml.transform.*;import javax.xml.transform.stream.*;import org.xml.sax.*;import java.io.IOException;public class TestJavaXslt{ public static void main(String[] args) throws TransformerException, TransformerConfigurationException, SAXException, IOException { TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource("Mint.xsl")); Transformer transformer1 = tFactory.newTransformer(new StreamSource("TemplatesTest.xsl")); transformer.transform(new StreamSource("mint001.xml"), new StreamResult("Test.xml")); transformer1.transform(new StreamSource("Test.xml"), new StreamResult("Result.xml")); } }\[/code\]The idea is as follows:
- I use xslt to transform xml file and I make two transformation with the file Mint.xsl apply on the file mint001.xml and the file TemplatesTest.xsl.
- The result of the first transformation is stored in the file Test.xml and then reused with the second xsl file named TemplatesTest.xsl to produce the last result of my transformation stored in the file Result.xml.
- I put all these file in the same folder and I want now to modify my code, so that if you save the both xsl file and the file mint001.xml under another name as mine, the program will function well without error.
- What I did is adapted especially to my example and i want to make it run general in any file with the extension .xsl and .xml.