Hello,
This is the full code and will help you for sure, check it out
Code:
Public static void Process(File[] lsfl){
try {
for(int i = 0; I <lsfl.length; I + +){
System.out.System.out.println("Target name" + lsfl[i].getName());
String shortname = (lsfl[i].getName() != null) ? lsfl[i].getName().substring(0, lsfl[i].getName().indexOf('.')) : "";
j + +;
System.out.System.out.println(lsfl[i].getAbsolutePath());
/ / build XML file
DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
fac.setNamespaceAware(true);
DocumentBuilder parser = fac.newDocumentBuilder();
/ / create the XML file
Document d = parser.parse(new File(lsfl[i]..getAbsolutePath()));
DOMSource sourceXML = new DOMSource(d);
/ / Create the XSL file
d = parser.parse(Hand.class.getResourceAsStream("Transformation.xsl"));
DOMSource src = new DOMSource(d);
TrFact = TransformerFactory TransformerFactory.newInstance();
trns trns = trFact.newTransformer(src);
trns.setOutputProperty(OutputKeys.Method, "html");
trns.setOutputProperty(OutputKeys.Encoding, "ISO-8859-1");
trns.setOutputProperty(OutputKeys.INDENT, "yes");
/ / Transformeur.setParameter ( "num", "6");
File fl1 = new File(shortname +. vm ");
FileOutputStream fos = new FileOutputStream(fl1);
if (fos! = null) {
Result out = new StreamResult(fos);
trns.transform(sourceXML exit);
}
fos.flush();
fos.close();
Bookmarks