@@ -102,18 +102,20 @@ public function getCssToXPathTestData()
102
102
array ('e[foo^="bar"] ' , "e[@foo and starts-with(@foo, 'bar')] " ),
103
103
array ('e[foo$="bar"] ' , "e[@foo and substring(@foo, string-length(@foo)-2) = 'bar'] " ),
104
104
array ('e[foo*="bar"] ' , "e[@foo and contains(@foo, 'bar')] " ),
105
+ array ('e[foo!="bar"] ' , "e[not(@foo) or @foo != 'bar'] " ),
106
+ array ('e[foo!="bar"][foo!="baz"] ' , "e[(not(@foo) or @foo != 'bar') and (not(@foo) or @foo != 'baz')] " ),
105
107
array ('e[hreflang|="en"] ' , "e[@hreflang and (@hreflang = 'en' or starts-with(@hreflang, 'en-'))] " ),
106
- array ('e:nth-child(1) ' , "*/*[name() = 'e' and (position() = 1)] " ),
107
- array ('e:nth-last-child(1) ' , "*/*[name() = 'e' and (position() = last() - 0)] " ),
108
- array ('e:nth-last-child(2n+2) ' , "*/*[name() = 'e' and (last() - position() - 1 >= 0 and (last() - position() - 1) mod 2 = 0)] " ),
108
+ array ('e:nth-child(1) ' , "*/*[( name() = 'e') and (position() = 1)] " ),
109
+ array ('e:nth-last-child(1) ' , "*/*[( name() = 'e') and (position() = last() - 0)] " ),
110
+ array ('e:nth-last-child(2n+2) ' , "*/*[( name() = 'e') and (last() - position() - 1 >= 0 and (last() - position() - 1) mod 2 = 0)] " ),
109
111
array ('e:nth-of-type(1) ' , '*/e[position() = 1] ' ),
110
112
array ('e:nth-last-of-type(1) ' , '*/e[position() = last() - 0] ' ),
111
113
array ('div e:nth-last-of-type(1) .aclass ' , "div/descendant-or-self::*/e[position() = last() - 0]/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' aclass ')] " ),
112
- array ('e:first-child ' , "*/*[name() = 'e' and (position() = 1)] " ),
113
- array ('e:last-child ' , "*/*[name() = 'e' and (position() = last())] " ),
114
+ array ('e:first-child ' , "*/*[( name() = 'e') and (position() = 1)] " ),
115
+ array ('e:last-child ' , "*/*[( name() = 'e') and (position() = last())] " ),
114
116
array ('e:first-of-type ' , '*/e[position() = 1] ' ),
115
117
array ('e:last-of-type ' , '*/e[position() = last()] ' ),
116
- array ('e:only-child ' , "*/*[name() = 'e' and (last() = 1)] " ),
118
+ array ('e:only-child ' , "*/*[( name() = 'e') and (last() = 1)] " ),
117
119
array ('e:only-of-type ' , 'e[last() = 1] ' ),
118
120
array ('e:empty ' , 'e[not(*) and not(string-length())] ' ),
119
121
array ('e:EmPTY ' , 'e[not(*) and not(string-length())] ' ),
@@ -127,7 +129,7 @@ public function getCssToXPathTestData()
127
129
array ('e:nOT(*) ' , 'e[0] ' ),
128
130
array ('e f ' , 'e/descendant-or-self::*/f ' ),
129
131
array ('e > f ' , 'e/f ' ),
130
- array ('e + f ' , "e/following-sibling::*[name() = 'f' and (position() = 1)] " ),
132
+ array ('e + f ' , "e/following-sibling::*[( name() = 'f') and (position() = 1)] " ),
131
133
array ('e ~ f ' , 'e/following-sibling::f ' ),
132
134
array ('div#container p ' , "div[@id = 'container']/descendant-or-self::*/p " ),
133
135
);
0 commit comments