DocumentStyler styler = new DocumentStyler(stylingEngine,
XDIMESchemata.CDM_NAMESPACE);
styler.style(document);
// Make sure that every element has styles set on it.
DOMWalker walker = new DOMWalker(new WalkingDOMVisitorStub() {
// Javadoc inherited.
public void visit(Element element) {
if (element.getStyles() == null) {
throw new IllegalArgumentException(
"element " + element.getName() + " has no styles");
}
}
});
walker.walk(document);
DOMTransformer transformer = new DeferredInheritTransformer();
document = transformer.transform(null, document);
return document;