semi implemented
This commit is contained in:
@@ -31,9 +31,8 @@ public class Saxon implements XmlEngine{
|
||||
Processor processor = new Processor(false);
|
||||
|
||||
XsltCompiler compiler = processor.newXsltCompiler();
|
||||
XsltExecutable stylesheet = compiler.compile(new StreamSource( new StringReader(transform) ));
|
||||
|
||||
String filesPath = "/tmp/"+UUID.randomUUID()+"/";
|
||||
ArrayList<String> xmlFilesUri = new ArrayList<>();
|
||||
try{
|
||||
Path processPath = Paths.get(filesPath);
|
||||
Files.createDirectories(processPath);
|
||||
@@ -42,23 +41,20 @@ public class Saxon implements XmlEngine{
|
||||
Path filePath = Files.createFile( Paths.get(filesPath + fileData.getFilename() ) );
|
||||
try (FileWriter writer = new FileWriter(filePath.toFile())) {
|
||||
writer.write(fileData.getData());
|
||||
xmlFilesUri.add(filesPath + fileData.getFilename());
|
||||
transform = transform.replace('\''+fileData.getFilename()+'\'',filesPath+fileData.getFilename());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XsltExecutable stylesheet = compiler.compile(new StreamSource( new StringReader(transform) ));
|
||||
StringWriter sw = new StringWriter();
|
||||
Serializer out = processor.newSerializer(sw);
|
||||
out.setOutputProperty(Serializer.Property.METHOD, "xml");
|
||||
out.setOutputProperty(Serializer.Property.INDENT, "yes");
|
||||
Xslt30Transformer transformer = stylesheet.load30();
|
||||
transformer.setResourceResolver( );
|
||||
processor.setCatalogFiles(xmlFilesUri.toArray(new String[0]));
|
||||
|
||||
transformer.transform( new StreamSource( new File(filesPath+data[0].getFilename()) ) , out );
|
||||
return sw.toString();
|
||||
|
||||
} finally {
|
||||
Thread.sleep(1000000);
|
||||
Files
|
||||
.walk( Paths.get(filesPath) )
|
||||
.sorted(Comparator.reverseOrder())
|
||||
|
||||
Reference in New Issue
Block a user