* with *
*/ class InlineElements extends AbstractNormalization { /** * {@inheritdoc} */ protected $queries = ['//xsl:element']; /** * {@inheritdoc} */ protected function normalizeElement(DOMElement $element) { $elName = $element->getAttribute('name'); $dom = $this->ownerDocument; try { // Create the new static element $newElement = ($element->hasAttribute('namespace')) ? $dom->createElementNS($element->getAttribute('namespace'), $elName) : $dom->createElement($elName); } catch (DOMException $e) { // Ignore this element if an exception got thrown return; } // Replace the old with it. We do it now so that libxml doesn't have to // redeclare the XSL namespace $element->parentNode->replaceChild($newElement, $element); // One by one and in order, we move the nodes from the old element to the new one while ($element->firstChild) { $newElement->appendChild($element->removeChild($element->firstChild)); } } }