public function NodeExtension::translateNegation in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/css-selector/XPath/Extension/NodeExtension.php \Symfony\Component\CssSelector\XPath\Extension\NodeExtension::translateNegation()
Parameters
Node\NegationNode $node:
Translator $translator:
Return value
File
- vendor/
symfony/ css-selector/ XPath/ Extension/ NodeExtension.php, line 122
Class
- NodeExtension
- XPath expression translator node extension.
Namespace
Symfony\Component\CssSelector\XPath\ExtensionCode
public function translateNegation(Node\NegationNode $node, Translator $translator) {
$xpath = $translator
->nodeToXPath($node
->getSelector());
$subXpath = $translator
->nodeToXPath($node
->getSubSelector());
$subXpath
->addNameTest();
if ($subXpath
->getCondition()) {
return $xpath
->addCondition(sprintf('not(%s)', $subXpath
->getCondition()));
}
return $xpath
->addCondition('0');
}