1package intfns 2 3import ( 4 "encoding/xml" 5 6 "github.com/ChrisTrenkamp/goxpath/tree" 7) 8 9//BuiltIn contains the list of built-in XPath functions 10var BuiltIn = map[xml.Name]tree.Wrap{ 11 //String functions 12 {Local: "string"}: {Fn: _string, NArgs: 1, LastArgOpt: tree.Optional}, 13 {Local: "concat"}: {Fn: concat, NArgs: 3, LastArgOpt: tree.Variadic}, 14 {Local: "starts-with"}: {Fn: startsWith, NArgs: 2}, 15 {Local: "contains"}: {Fn: contains, NArgs: 2}, 16 {Local: "substring-before"}: {Fn: substringBefore, NArgs: 2}, 17 {Local: "substring-after"}: {Fn: substringAfter, NArgs: 2}, 18 {Local: "substring"}: {Fn: substring, NArgs: 3, LastArgOpt: tree.Optional}, 19 {Local: "string-length"}: {Fn: stringLength, NArgs: 1, LastArgOpt: tree.Optional}, 20 {Local: "normalize-space"}: {Fn: normalizeSpace, NArgs: 1, LastArgOpt: tree.Optional}, 21 {Local: "translate"}: {Fn: translate, NArgs: 3}, 22 //Node set functions 23 {Local: "last"}: {Fn: last}, 24 {Local: "position"}: {Fn: position}, 25 {Local: "count"}: {Fn: count, NArgs: 1}, 26 {Local: "local-name"}: {Fn: localName, NArgs: 1, LastArgOpt: tree.Optional}, 27 {Local: "namespace-uri"}: {Fn: namespaceURI, NArgs: 1, LastArgOpt: tree.Optional}, 28 {Local: "name"}: {Fn: name, NArgs: 1, LastArgOpt: tree.Optional}, 29 //boolean functions 30 {Local: "boolean"}: {Fn: boolean, NArgs: 1}, 31 {Local: "not"}: {Fn: not, NArgs: 1}, 32 {Local: "true"}: {Fn: _true}, 33 {Local: "false"}: {Fn: _false}, 34 {Local: "lang"}: {Fn: lang, NArgs: 1}, 35 //number functions 36 {Local: "number"}: {Fn: number, NArgs: 1, LastArgOpt: tree.Optional}, 37 {Local: "sum"}: {Fn: sum, NArgs: 1}, 38 {Local: "floor"}: {Fn: floor, NArgs: 1}, 39 {Local: "ceiling"}: {Fn: ceiling, NArgs: 1}, 40 {Local: "round"}: {Fn: round, NArgs: 1}, 41} 42