Created
February 1, 2017 16:44
-
-
Save torstenwerner/e0a170e41027f12fca18b1c78d6441e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple schematron executer for a schema which is embedded into a Xml schema. | |
*/ | |
import javax.xml.transform.TransformerFactory | |
import javax.xml.transform.stream.StreamResult | |
import javax.xml.transform.stream.StreamSource | |
def schemaName = 'choice-schematron.xsd' | |
def instanceName = 'instance-schematron.xml' | |
def reportName = 'instance.svrlt' | |
factory = TransformerFactory.newInstance() | |
transform('ExtractSchFromXSD.xsl', schemaName, 'choice.sch') | |
transform('iso_svrl_for_xslt1.xsl', 'choice.sch', 'choice-schematron.xsl') | |
transform('choice-schematron.xsl', instanceName, reportName) | |
def transform(xsltName, inputName, outputName) { | |
def xslt = new StreamSource(new File(xsltName)) | |
def transformer = factory.newTransformer(xslt) | |
def input = new StreamSource(new File(inputName)) | |
def output = new StreamResult(new File(outputName)) | |
transformer.transform(input, output) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment