public function count() { if ($node = $this->getFirstElement()) { return $node->attributes->length; } return 0; }