Class SchematronTransformer

java.lang.Object
org.projecthusky.validation.service.schematron.SchematronTransformer

@NotThreadSafe public class SchematronTransformer extends Object
A transformer from Schematron files (.sch) to XML Stylesheet Transform files (.xsl). Schematron validators usually need the transformed XSLT files to execute them against the file to test.

The underlying XML Transformer is not thread safe.

Author:
Quentin Ligier
  • Constructor Details

  • Method Details

    • convertToXslt

      public void convertToXslt(File schematronFile, File xsltFile) throws TransformerException, IOException
      Transforms a Schematron file to a 'compiled' XSLT file.
      Parameters:
      schematronFile - The source Schematron (.sch) file.
      xsltFile - The destination XSLT (.xsl) file.
      Throws:
      TransformerException - if the XML transformation fails.
      IOException
    • convertToXslt

      public byte[] convertToXslt(byte[] schematronContent) throws TransformerException
      Transforms a Schematron content to a 'compiled' XSLT content.
      Parameters:
      schematronContent - The source Schematron (.sch) content.
      Returns:
      the content of the transformed XSLT.
      Throws:
      TransformerException - if the XML transformation fails.
    • convertToXslt

      public byte[] convertToXslt(File schematronFile) throws TransformerException
      Transforms a Schematron file to a 'compiled' XSLT content.
      Parameters:
      schematronFile - The source Schematron (.sch) file.
      Returns:
      the content of the transformed XSLT.
      Throws:
      TransformerException - if the XML transformation fails.
    • convertToXslt

      public void convertToXslt(com.helger.commons.io.resource.IReadableResource readableResource, Writer outputWriter) throws TransformerException
      Transforms a Schematron resource and writes it to an output Writer.
      Parameters:
      readableResource - The Schematron resource to transform.
      outputWriter - The output writer.
      Throws:
      TransformerException - if the XML transformation fails.