final String dialectPrefix = Attribute.getPrefixFromAttributeName(attributeName);
final String fragmentSignatureAttributeName =
getFragmentSignatureUnprefixedAttributeName(arguments, element, attributeName, attributeValue);
final StandardFragment fragment =
StandardFragmentProcessor.computeStandardFragmentSpec(
arguments.getConfiguration(), arguments, attributeValue, dialectPrefix, fragmentSignatureAttributeName);
final List<Node> extractedNodes =
fragment.extractFragment(arguments.getConfiguration(), arguments, arguments.getTemplateRepository());
final boolean removeHostNode = getRemoveHostNode(arguments, element, attributeName, attributeValue);
// If fragment is a whole document (no selection inside), we should never remove its parent node/s
// Besides, we know that StandardFragmentProcessor.computeStandardFragmentSpec only creates two types of
// IFragmentSpec objects: WholeFragmentSpec and DOMSelectorFragmentSpec.
final boolean isWholeDocument = (fragment.getFragmentSpec() instanceof WholeFragmentSpec);
if (extractedNodes == null || removeHostNode || isWholeDocument) {
return extractedNodes;
}