Beispiel #1
0
 /**
  * undocumented function
  *
  * @param XPath\Expression $xpath The XPath expression
  * @return XPath\Expression The modified expression
  */
 protected function xpath_empty($xpath)
 {
     $xpath->addCondition('not(*) and not(normalize-space())');
     return $xpath;
 }
Beispiel #2
0
 /**
  * undocumented function
  *
  * @param XPath\Expression $xpath
  * @param mixed $expr
  * @return XPath\Expression
  */
 protected function xpath_not(XPath\Expression $xpath, $expr)
 {
     // everything for which not expr applies
     if ($expr instanceof ElementSelector) {
         $xpath->addCondition(sprintf("not(name() = '%s')", $expr->toXpath()));
         return $xpath;
     }
     $expr = $expr->toXPath();
     $cond = $expr->getCondition();
     if ($cond) {
         // FIXME: should I do something about element_path?
         $xpath->addCondition(sprintf('not(%s)', $cond));
     } else {
         $xpath->addCondition('0');
     }
     return $xpath;
 }