+ * @throws IOException
+ * In case of problems reading resources.
+ * @throws TransformerException
+ * In case transformation fails.
+ */
+ public Document transform(byte[] aDocument, InputResource aXslt)
+ throws IOException, TransformerException {
+ Source source = new StreamSource(new ByteArrayInputStream(aDocument));
+ DOMResult result = new DOMResult();
+ transform(source, result, aXslt);
+ return (Document) result.getNode();
+ }
+
+ /**
+ * Transforms a document to a text output. This supports XSLT transformations
+ * that result in text documents.
+ * @param aDocument Document to transform.
+ * @param aXslt XSL transformation.
+ * @return Transformed document.
+ */
+ public String textTransform(byte[] aDocument, InputResource aXslt) throws IOException, TransformerException {
+ Source source = new StreamSource(new ByteArrayInputStream(aDocument));
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ StreamResult result = new StreamResult(os);
+ transform(source, result, aXslt);
+ return new String(os.toByteArray());
+ }
+
+ /**
+ * Transforms a document using XSLT.
+ *
+ * @param aSource
+ * Document to transform.
+ * @param aResult
+ * Result of the transformation.
+ * @param aXslt
+ * XSLT to use.
+ * @throws IOException
+ * In case of problems reading resources.
+ * @throws TransformerException
+ * In case transformation fails.