// FIXME: Calling getLastModified here has the side effect of checking whether the XML
// has been modified, and if so, updating it. This is mysterious and should be
// replaced with a more transparent mechanism or at least a better name for the method.
doc.getLastModified();
for (XmlSection rs : doc.getTocSection().getChildren()) { // For each chapter in the document
ISIXmlSection rootSection = (ISIXmlSection) rs;
WebMarkupContainer rootSectionContainer = new WebMarkupContainer(chapterRepeater.newChildId());
chapterRepeater.add(rootSectionContainer);
// Chapter that contains the bookmark is open by default.
if (rootSection.equals(currentRootSection))
rootSectionContainer.add(new ClassAttributeModifier("open"));
rootSectionContainer.add(new Label("chapterTitle", rootSection.getTitle()));
ISIXmlComponent xml = new ISIXmlComponent("chapterContent", new XmlSectionModel(rootSection), "toc");
xml.setTransformParameter("sectionToggleLinks", getSectionToggleParameter());
xml.setTransformParameter("sectionLevel", sectionLevel);
if (currentPage != null)
xml.setTransformParameter("current", currentPage.getSectionAncestor().getId());