1<?php 2 3/** 4* @package s9e\TextFormatter 5* @copyright Copyright (c) 2010-2021 The s9e authors 6* @license http://www.opensource.org/licenses/mit-license.php The MIT License 7*/ 8namespace s9e\TextFormatter\Configurator\TemplateNormalizations; 9 10use DOMNode; 11 12/** 13* Convert comments into xsl:comment elements 14*/ 15class TransposeComments extends AbstractNormalization 16{ 17 /** 18 * {@inheritdoc} 19 */ 20 protected $queries = ['//comment()']; 21 22 /** 23 * {@inheritdoc} 24 */ 25 protected function normalizeNode(DOMNode $node) 26 { 27 $xslComment = $this->createElement('xsl:comment', $node->nodeValue); 28 $node->parentNode->replaceChild($xslComment, $node); 29 } 30}