make report optional

This commit is contained in:
apenski 2022-11-09 16:34:07 +01:00
parent 9f3ded6e5b
commit 55ec1dc560
4 changed files with 73 additions and 30 deletions

View file

@ -17,6 +17,7 @@
package de.kosit.validationtool.impl;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@ -265,4 +266,18 @@ public class ContentRepository {
public Transformation createSchematronTransformation(final ValidateWithSchematron validateWithSchematron) {
return createTransformation(validateWithSchematron.getResource());
}
public Transformation createIdentityTransformation() {
final URL url = ContentRepository.class.getClassLoader().getResource("transform/identity.xsl");
try ( final InputStream input = url.openStream() ) {
final XsltCompiler xsltCompiler = getProcessor().newXsltCompiler();
final XsltExecutable executable = xsltCompiler.compile(new StreamSource(input));
final ResourceType resource = new ResourceType();
resource.setName("identity");
resource.setLocation(url.toString());
return new Transformation(executable, resource);
} catch (final IOException | SaxonApiException e) {
throw new IllegalStateException("Error creating identity transformation", e);
}
}
}