builder.setProject(pageContext.getCurrentProject());
builder.setBaseURL(pageContext.getBaseURL());
builder.setStyleSheetCompilerFactory(
ThemeStyleSheetCompilerFactory.getDefaultInstance());
builder.setParserMode(CSSParserMode.LAX);
CSSCompiler cssCompiler = builder.getCSSCompiler();
// Parse and then compile the css into compiled style sheet.
CompiledStyleSheet compiledStyleSheet =
cssCompiler.compile(new StringReader(css), null);
// Add the compiled style sheet into the html element to be
// processed later.
htmlElement.addInlineStyleSheet(compiledStyleSheet);
}