, e.g. * * * * * * into * */ class OptimizeConditionalAttributes extends AbstractNormalization { /** * {@inheritdoc} */ protected $queries = ['//xsl:if[starts-with(@test, "@")][count(descendant::node()) = 2][xsl:attribute[@name = substring(../@test, 2)][xsl:value-of[@select = ../../@test]]]']; /** * {@inheritdoc} */ protected function normalizeElement(DOMElement $element) { $copyOf = $this->createElement('xsl:copy-of'); $copyOf->setAttribute('select', $element->getAttribute('test')); $element->parentNode->replaceChild($copyOf, $element); } }