ph-schematron/src/main/java/com/helger/schematron/xslt/SchematronResourceSCHCache.java
@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;
  }
@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;
  }
@ 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.

@param aSchematronResource
The resource of the Schematron rules. May not be <code>null</code>.
@param aTransformerCustomizer
The XSLT transformer customizer to be used. May not be
<code>null</code>.
@return <code>null</code> if the passed Schematron resource does not exist
or is invalid.
Create a new Schematron validator for the passed resource .