Apologies as i know this question has been asked before but i've tried doing what was said with still no luck. I am getting this error everytime:
java.lang.NullPointerException
at test.XSLTransformer.main(XSLTransformer.java:35)
ERROR: 'Could not compile stylesheet'
FATAL ERROR: 'java.lang.NullPointerException'
:null
Exception in thread "main" javax.xml.transform.TransformerConfigurationException: java.lang.NullPointerException
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:988)
at test.XSLTransformer.main(XSLTransformer.java:35)
// ...
import jdk.nashorn.internal.runtime.regexp.JoniRegExp;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import java.io.*;
import java.net.URISyntaxException;
import java.util.Scanner;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
// ...
public class XSLTransformer {
public static void main(String[] args) throws IOException, URISyntaxException, TransformerException {
File xmlFile = new File("D:\\FastFlow.IntegrationDb-Data.xml"); // source file
File resultFile = new File ("D:\\staffnumbers.xml"); // result file
File xslFile = new File ("D:\\CanonicalSectionTmpltTOPMNF.xsl"); // template file
TransformerFactory factory = TransformerFactory.newInstance(); // this is the line that throws the exception
Source xslInput = new StreamSource(xslFile);
Templates xsl = factory.newTemplates(xslInput);
Transformer transformer = factory.newTransformer(xslInput);
Source xmlInput = new StreamSource(xmlFile);
Result result = new StreamResult(resultFile);
transformer.transform(xmlInput,result);
System.out.println(result.toString());
}
} ```