code: private static Transformer transformer(final TransformerFactory factory,
          final Source stylesheet) throws TransformerConfigurationException {
          final Transformer tnfr = factory.newTransformer(stylesheet);
          if (tnfr == null) {
              throw new TransformerConfigurationException(
                  String.format(
                      "%s failed to create new XSL transformer for '%s'",
                      factory.getClass(),
                      stylesheet.getSystemId()
                  )
              );
          }
          return tnfr;
      }
docs: Make a transformer from this stylesheet.
  @param factory Transformer factory
  @param stylesheet The stylesheet
  @return Transformer
  @throws TransformerConfigurationException If fails