@ Nullable public static SchematronProviderXSLTFromSCH createSchematronXSLTProvider ( @ Nonnull final IReadableResource aSchematronResource , @ Nonnull final SCHTransformerCustomizer aTransformerCustomizer ) { if ( LOGGER . isDebugEnabled ( ) ) LOGGER . debug ( "Compiling Schematron instance " + aSchematronResource . toString ( ) ) ; final SchematronProviderXSLTFromSCH aXSLTPreprocessor = new SchematronProviderXSLTFromSCH ( aSchematronResource , aTransformerCustomizer ) ; if ( ! aXSLTPreprocessor . isValidSchematron ( ) ) { // Schematron is invalid -> parsing failed LOGGER . warn ( "The Schematron resource '" + aSchematronResource . getResourceID ( ) + "' is invalid!" ) ; if ( LOGGER . isDebugEnabled ( ) && aXSLTPreprocessor . getXSLTDocument ( ) != null ) { // Log the created XSLT document for better error tracking LOGGER . debug ( " Created XSLT document:\n" + XMLWriter . getNodeAsString ( aXSLTPreprocessor . getXSLTDocument ( ) ) ) ; } return null ; } // If it is a valid schematron, there must be a result XSLT present! if ( aXSLTPreprocessor . getXSLTDocument ( ) == null ) throw new IllegalStateException ( "No XSLT document retrieved from Schematron resource '" + aSchematronResource . getResourceID ( ) + "'!" ) ; if ( LOGGER . isDebugEnabled ( ) ) LOGGER . debug ( "Finished compiling Schematron instance " + aSchematronResource . toString ( ) ) ; // Create the main validator for the schematron return aXSLTPreprocessor ; }
Create a new Schematron validator for the passed resource .