/**
  * @testdox minify() tests
  * @dataProvider getMinifyTests
  */
 public function testMinify($original, $expected)
 {
     if ($expected instanceof Exception) {
         $this->setExpectedException(get_class($expected), $expected->getMessage());
     }
     $this->assertSame($expected, XPathHelper::minify($original));
 }
 /**
  * Remove extraneous space in XPath expressions used in XSL elements
  *
  * @param  DOMElement $template <xsl:template/> node
  * @return void
  */
 public function normalize(DOMElement $template)
 {
     $xpath = new DOMXPath($template->ownerDocument);
     // Get all the "match", "select" and "test" attributes of XSL elements, whose value contains
     // a space
     $query = '//xsl:*/@*[contains(., " ")][contains("matchselectest", name())]';
     foreach ($xpath->query($query) as $attribute) {
         $attribute->parentNode->setAttribute($attribute->nodeName, XPathHelper::minify($attribute->nodeValue));
     }
     // Get all the attributes of non-XSL elements, whose value contains a space
     $query = '//*[namespace-uri() != "' . self::XMLNS_XSL . '"]' . '/@*[contains(., " ")]';
     foreach ($xpath->query($query) as $attribute) {
         AVTHelper::replace($attribute, function ($token) {
             if ($token[0] === 'expression') {
                 $token[1] = XPathHelper::minify($token[1]);
             }
             return $token;
         });
     }
 }