SourceGrammarFileType.GRAMMAR.getFileName())
? "index" : baseName);
fb.append(".html");
String targetName = fb.toString();
SourceGrammarFile sourceFile
= grammar.getSourceGrammarFile(fileType);
Templates templates = loadTemplates(baseName);
if(templates != null) {
documenterContext.log("Generating " + targetName);
try {
File f = new File(destDir, targetName);
StreamResult res = new StreamResult(
new BufferedOutputStream(new FileOutputStream(f)));
res.setSystemId(f);
Transformer transformer = templates.newTransformer();
transformer.setURIResolver(this);
transformer.setParameter("sections", sections);
transformer.transform(
new StreamSource(sourceFile.getSourceFile()), res);
}
catch(TransformerException te) {
throw new DocumenterSourceException(
"problem transforming output: "
+ te.getMessageAndLocation(), te,