I know its possible to remove empty XML tags using XPath (as seen here - Remove empty tags from a XML with PHP)
$xpath = new DOMXPath($doc);
foreach( $xpath->query('//*[not(node())]') as $node ) {
$node->parentNode->removeChild($node);
}
$doc->formatOutput = true;
echo $doc->savexml();
but is it possible to use a similar method to still remove empty tags but keep ones that have attributes?
e.g.
<range starts_at="2012-11-22" ends_at="2012-11-26"></range>