&& "resource".equals(element.getLocalName())) {
Element table = new Element("table", XHTML_NAMESPACE);
// move the content
Element tr = new Element("tr", XHTML_NAMESPACE);
Element td = new Element("td", XHTML_NAMESPACE);
td.addAttribute(new Attribute("colspan", "2"));
tr.appendChild(td);
while (element.getChildCount() > 0) {
Node child = element.removeChild(0);
td.appendChild(child);
}
table.appendChild(tr);
Attribute href = element.getAttribute("role", XLINK_NAMESPACE);
if (href != null) {
element.removeAttribute(href);
Element trhref = new Element("tr", XHTML_NAMESPACE);
Element tdhref1 = new Element("td", XHTML_NAMESPACE);
Element tdhref2 = new Element("td", XHTML_NAMESPACE);
tdhref1.appendChild("href: ");
tdhref2.appendChild(href.getValue());
trhref.appendChild(tdhref1);
trhref.appendChild(tdhref2);
table.insertChild(trhref, 0);
}
Attribute arcrole = element.getAttribute("role", XLINK_NAMESPACE);
if (arcrole != null) {
element.removeAttribute(arcrole);
Element trarcrole = new Element("tr", XHTML_NAMESPACE);
Element tdarcrole1 = new Element("td", XHTML_NAMESPACE);
Element tdarcrole2 = new Element("td", XHTML_NAMESPACE);
tdarcrole1.appendChild("arcrole: ");
tdarcrole2.appendChild(arcrole.getValue());
trarcrole.appendChild(tdarcrole1);
trarcrole.appendChild(tdarcrole2);
table.insertChild(trarcrole, 0);
}
Attribute role = element.getAttribute("role", XLINK_NAMESPACE);
if (role != null) {
element.removeAttribute(role);
Element trrole = new Element("tr", XHTML_NAMESPACE);
Element tdrole1 = new Element("td", XHTML_NAMESPACE);
Element tdrole2 = new Element("td", XHTML_NAMESPACE);
tdrole1.appendChild("role: ");
tdrole2.appendChild(role.getValue());
trrole.appendChild(tdrole1);
trrole.appendChild(tdrole2);
table.insertChild(trrole, 0);
}
Attribute id = element.getAttribute("id");
if (id != null) {
element.removeAttribute(id);
Element caption = new Element("caption", XHTML_NAMESPACE);
caption.appendChild(id.getValue());
table.insertChild(caption, 0);
}
result = table;
}
return new Nodes(result);