if (!action.equals(ACTION_DETACH) && show.equalsIgnoreCase(XLink.SHOW_REPLACE)) {
remoteFragment.setAttribute((Attribute)xlink.clone());
remoteFragment.setAttribute(new Attribute(XLink.SHOW, XLink.SHOW_REPLACE, XLink.NAMESPACE_XLINK));
}
Element parent = element.getParentElement();
int index = parent.indexOf(element);
parent.setContent(index,remoteFragment);
} else { // show = XLink.SHOW_EMBED
// replace children of this element with the fragment
element.removeContent();
element.addContent(remoteFragment);