Ejemplo n.º 1
0
 protected static function notExists(DOMXPath $xpath, ChariotContext $context, ChariotTagRepository $repository)
 {
     $nodes = array();
     if (isset($context->currentNode)) {
         $nodes = $xpath->query('*[@c:notExists]', $context->currentNode);
     } else {
         $nodes = $xpath->query('//*[@c:notExists]');
     }
     foreach ($nodes as $child) {
         $existsValue = $child->getAttributeNodeNS(self::URN, 'notExists')->nodeValue;
         $child->removeAttributeNS(self::URN, 'notExists');
         if ($context->hasAttribute($existsValue)) {
             $child->nodeValue = '';
             $child->parentNode->removeChild($child);
             continue;
         }
         $ctx = $context->createChild();
         $ctx->currentIndex = -1;
         $ctx->currentValue = null;
         $ctx->currentNode = $child;
         $repos = clone $repository;
         foreach ($repos as $r) {
             $r->start($ctx, $repository);
         }
     }
 }