code: public static void transform(final Source input, final Source sheet, final Result output) {
          try {
              final DOMResult intermediate = new DOMResult(createEmptyDocument());
  
              // Transform.
              createTransformer(sheet).transform(input, intermediate);
  
              // Format.
              format(new DOMSource(intermediate.getNode()), output);
          } catch (final Exception ex) {
              LOGGER.error("Problem transforming XML file.", ex);
          }
      }
docs: Transform an XML document according to an XSL style sheet.
  
  @param input
  The input XML {@link Source}.
  @param sheet
  The XSL style sheet according to which the document must be transformed.
  @param output
  The {@link Result} in which the transformed XML is to be stored.