createElement('xsl:otherwise'); while ($when->firstChild) { $otherwise->appendChild($when->firstChild); } $when->parentNode->replaceChild($otherwise, $when); } /** * {@inheritdoc} */ protected function optimizeChoose() { $removeAll = false; $tests = []; foreach ($this->getBranches() as $branch) { $test = trim($branch->getAttribute('test')); if ($removeAll || isset($tests[$test]) || $this->isAlwaysFalse($test)) { $branch->parentNode->removeChild($branch); } elseif ($this->isAlwaysTrue($test)) { $removeAll = true; $this->makeOtherwise($branch); } $tests[$test] = 1; } } }