} catch (Exception e) {
throw new BuildException(MessageFormat.format(
Messages.getString("MarkupToHtmlTask.16"), htmlOutputFile, e.getMessage()), e); //$NON-NLS-1$
}
try {
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer, formatOutput);
for (Stylesheet stylesheet : stylesheets) {
HtmlDocumentBuilder.Stylesheet builderStylesheet;
if (stylesheet.url != null) {
builderStylesheet = new HtmlDocumentBuilder.Stylesheet(stylesheet.url);
} else {
builderStylesheet = new HtmlDocumentBuilder.Stylesheet(stylesheet.file);
}
builder.addCssStylesheet(builderStylesheet);
if (!stylesheet.attributes.isEmpty()) {
for (Map.Entry<String, String> attr : stylesheet.attributes.entrySet()) {
builderStylesheet.getAttributes().put(attr.getKey(), attr.getValue());
}
}
}
builder.setTitle(title == null ? name : title);
builder.setEmitDtd(emitDoctype);
if (emitDoctype && htmlDoctype != null) {
builder.setHtmlDtd(htmlDoctype);
}
builder.setUseInlineStyles(useInlineCssStyles);
builder.setSuppressBuiltInStyles(suppressBuiltInCssStyles);
builder.setLinkRel(linkRel);
builder.setDefaultAbsoluteLinkTarget(defaultAbsoluteLinkTarget);
builder.setPrependImagePrefix(prependImagePrefix);
builder.setXhtmlStrict(xhtmlStrict);
SplittingStrategy splittingStrategy = multipleOutputFiles ? new DefaultSplittingStrategy()
: new NoSplittingStrategy();
SplittingOutlineParser outlineParser = new SplittingOutlineParser();
outlineParser.setMarkupLanguage(markupLanguage.clone());