From fd14a124c6f9df8ddac8655cdf0406936267d847 Mon Sep 17 00:00:00 2001 From: Alec Date: Fri, 23 Oct 2020 11:31:04 -0400 Subject: [PATCH] Allow multiple evaulations of functions 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 --- func.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/func.go b/func.go index bcfee55..df2542b 100644 --- a/func.go +++ b/func.go @@ -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 "" } @@ -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 "" } @@ -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 "" }