axisPredicate creates a predicate to predicating for this axis node.
(root *axisNode)
| 45 | |
| 46 | // axisPredicate creates a predicate to predicating for this axis node. |
| 47 | func axisPredicate(root *axisNode) func(NodeNavigator) bool { |
| 48 | nametest := root.LocalName != "" || root.Prefix != "" |
| 49 | predicate := func(n NodeNavigator) bool { |
| 50 | if root.typeTest == n.NodeType() || root.typeTest == allNode { |
| 51 | if nametest { |
| 52 | type namespaceURL interface { |
| 53 | NamespaceURL() string |
| 54 | } |
| 55 | if ns, ok := n.(namespaceURL); ok && root.hasNamespaceURI { |
| 56 | return root.LocalName == n.LocalName() && root.namespaceURI == ns.NamespaceURL() |
| 57 | } |
| 58 | if root.LocalName == n.LocalName() && root.Prefix == n.Prefix() { |
| 59 | return true |
| 60 | } |
| 61 | } else { |
| 62 | return true |
| 63 | } |
| 64 | } |
| 65 | return false |
| 66 | } |
| 67 | |
| 68 | return predicate |
| 69 | } |
| 70 | |
| 71 | // processAxis processes a query for the XPath axis node. |
| 72 | func (b *builder) processAxis(root *axisNode, flags flag, props *builderProp) (query, error) { |
no test coverage detected
searching dependent graphs…