Hello,
first of all, thanks for your amazing work, it's really useful to me.
I'm having an issue when using the last() function on a subgroup, for example on a result of another filter.
For example, this piece of code:
package main
import (
"fmt"
"github.com/antchfx/xmlquery"
"strings"
)
func main() {
xml := `
<root>
<test foo="bar">First</test>
<test foo="bar">Second</test>
<test foo="xyz">Third</test>
</root>
`
doc, err := xmlquery.Parse(strings.NewReader(xml))
if err != nil {
panic(err)
}
tests, err := xmlquery.QueryAll(doc, `(//test[@foo="bar"])[last()]`)
if err != nil {
panic(err)
}
for _, test := range tests {
fmt.Println(test.InnerText())
}
}
I would expect this to print "Second", but it prints nothing, because the output from the query has no elements.
Am I doing something wrong, or is this an issue on the last() function?
Thank you!
Hello,
first of all, thanks for your amazing work, it's really useful to me.
I'm having an issue when using the
last()function on a subgroup, for example on a result of another filter.For example, this piece of code:
I would expect this to print "Second", but it prints nothing, because the output from the query has no elements.
Am I doing something wrong, or is this an issue on the last() function?
Thank you!