XdmNode doc = source.read();
try {
Sink sink = new Sink();
StreamProcessor sp = new StreamProcessor(RdfaParser.connect(sink));
// HACK!!!
// FIXME: set serializer properties appropriately!
Serializer serializer = makeSerializer();
StringWriter writer = new StringWriter();
serializer.setOutputWriter(writer);
S9apiUtils.serialize(runtime, doc, serializer);
writer.close();
ByteArrayInputStream bais = new ByteArrayInputStream(writer.toString().getBytes("UTF-8"));
sp.process(bais, doc.getBaseURI().toASCIIString());
} catch (IOException e) {
throw new XProcException(e);
} catch (ParseException e) {
throw new XProcException(e);
}