... * with * ... */ class InlineAttributes extends AbstractNormalization { /** * {@inheritdoc} */ protected $queries = ['//*[namespace-uri() != $XSL]/xsl:attribute']; /** * {@inheritdoc} */ protected function normalizeElement(DOMElement $element) { $value = ''; foreach ($element->childNodes as $node) { if ($node instanceof DOMText || $this->isXsl($node, 'text')) { $value .= preg_replace('([{}])', '$0$0', $node->textContent); } elseif ($this->isXsl($node, 'value-of')) { $value .= '{' . $node->getAttribute('select') . '}'; } else { // Can't inline this attribute return; } } $element->parentNode->setAttribute($element->getAttribute('name'), $value); $element->parentNode->removeChild($element); } }