Skip to content

Commit

Permalink
fix #75, supports filter expression using parent expression, like //a[@b
Browse files Browse the repository at this point in the history
='../../@b']
  • Loading branch information
zhengchun committed May 21, 2022
1 parent 5da9b3e commit 7a0d04a
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,28 @@ func cmpNodeSetString(t iterator, op string, m, n interface{}) bool {
func cmpNodeSetNodeSet(t iterator, op string, m, n interface{}) bool {
a := m.(query)
b := n.(query)
x := a.Select(t)
if x == nil {
return false
}
y := b.Select(t)
if y == nil {
return false
for {
x := a.Select(t)
if x == nil {
return false
}

y := b.Select(t)
if y == nil {
return false
}

for {
if cmpStringStringF(op, x.Value(), y.Value()) {
return true
}
if y = b.Select(t); y == nil {
break
}
}
// reset
b.Evaluate(t)
}
return cmpStringStringF(op, x.Value(), y.Value())
}

func cmpStringNumeric(t iterator, op string, m, n interface{}) bool {
Expand Down

0 comments on commit 7a0d04a

Please sign in to comment.