} else { // "#ID" or "ID" case:
file = getModel().getObject().getXmlDocument().getName(); // same file as we're currently viewing
}
XmlDocument document = xmlService.getDocument(file);
String xmlId = href.substring(hashLocation+1);
XmlSection section = document.getById(xmlId);
XmlSectionModel mSection = new XmlSectionModel(section);
return new AuthoredPopupLink(wicketId, xmlId, mSection);
} else if (wicketId.startsWith("noteBackLink_")) {
// Link back from a note to its (first) noteref.
String idref = elt.getAttribute("idref");
// Find candidate noterefs in this chapter
XmlSection sec = getModel().getObject();
XPath xPath = XPathFactory.newInstance().newXPath();
xPath.setNamespaceContext(XmlService.get().getNamespaceContext());
XmlSection linkSection = null;
String linkText = "?";
try {
String path = String.format("//dtb:noteref[@idref='#%s']", idref);
NodeList nl = (NodeList) xPath.evaluate(path, sec.getXmlDocument().getDocument().getDocumentElement(), XPathConstants.NODESET);
if (nl.getLength() > 0) {