*/
public final Document transform(String type, String source, Parameters parameters, Document input)
throws SAXException, ProcessingException, IOException {
ServiceSelector selector = null;
Transformer transformer = null;
SourceResolver resolver = null;
SAXParser parser = null;
Source inputsource = null;
assertNotNull("Test for component manager", this.getManager());
Document document = null;
try {
selector = (ServiceSelector) this.lookup(Transformer.ROLE+
"Selector");
assertNotNull("Test lookup of transformer selector", selector);
resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
assertNotNull("Test lookup of source resolver", resolver);
parser = (SAXParser) this.lookup(SAXParser.ROLE);
assertNotNull("Test lookup of parser", parser);
assertNotNull("Test if transformer name is not null", type);
transformer = (Transformer) selector.select(type);
assertNotNull("Test lookup of transformer", transformer);
transformer.setup(new SourceResolverAdapter(resolver),
objectmodel, source, parameters);
DOMBuilder builder = new DOMBuilder();
transformer.setConsumer(new WhitespaceFilter(builder));
assertNotNull("Test if input document is not null", input);
DOMStreamer streamer = new DOMStreamer(transformer);
streamer.stream(input);