Exemplo n.º 1
0
 /**
  * Sets the XPath expression to be only of type.
  *
  * @param XPath\Expression $xpath The XPath expression
  * @return XPath\Expression The modified expression
  * @throws ParseException Because *:only-of-type is not implemented
  */
 protected function xpath_only_of_type($xpath)
 {
     if ($xpath->getElement() == '*') {
         //$xpath->addStarPrefix();
         //$xpath->addCondition("count(../child::*[name(current()) = name(*)]) = 1");
         throw new UnsupportedSelectorException('*:only-of-type is not implemented');
     } else {
         $xpath->addCondition('last() = 1');
     }
     return $xpath;
 }
Exemplo n.º 2
0
 /**
  * undocumented function
  *
  * @param XPath\Expression $xpath
  * @param mixed $expr
  * @return XPath\Expression
  */
 protected function xpath_nth_of_type(XPath\Expression $xpath, $expr)
 {
     if ($xpath->getElement() == '*') {
         throw new ParseException('*:nth-of-type() is not implemented');
     }
     return $this->xpath_nth_child($xpath, $expr, false, false);
 }