Skip to content

Commit

Permalink
Allow multiple evaulations of functions
Browse files Browse the repository at this point in the history
Name LocalName, and NameSpace functions take a query argument. Clone the argument before running Select on it to get the first matching node on every evaluation
  • Loading branch information
AlecY committed Oct 23, 2020
1 parent 7ceb193 commit fd14a12
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions func.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func nameFunc(arg query) func(query, iterator) interface{} {
if arg == nil {
v = t.Current()
} else {
v = arg.Select(t)
v = arg.Clone().Select(t)
if v == nil {
return ""
}
Expand All @@ -176,7 +176,7 @@ func localNameFunc(arg query) func(query, iterator) interface{} {
if arg == nil {
v = t.Current()
} else {
v = arg.Select(t)
v = arg.Clone().Select(t)
if v == nil {
return ""
}
Expand All @@ -193,7 +193,7 @@ func namespaceFunc(arg query) func(query, iterator) interface{} {
v = t.Current()
} else {
// Get the first node in the node-set if specified.
v = arg.Select(t)
v = arg.Clone().Select(t)
if v == nil {
return ""
}
Expand Down

0 comments on commit fd14a12

Please sign in to comment.