File: intfns.go

package info (click to toggle)
golang-github-christrenkamp-goxpath 1.0~alpha3%2Bgit20170922.c385f95-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 308 kB
  • sloc: sh: 16; makefile: 3; xml: 3
file content (41 lines) | stat: -rw-r--r-- 1,805 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package intfns

import (
	"encoding/xml"

	"github.com/ChrisTrenkamp/goxpath/tree"
)

//BuiltIn contains the list of built-in XPath functions
var BuiltIn = map[xml.Name]tree.Wrap{
	//String functions
	{Local: "string"}:           {Fn: _string, NArgs: 1, LastArgOpt: tree.Optional},
	{Local: "concat"}:           {Fn: concat, NArgs: 3, LastArgOpt: tree.Variadic},
	{Local: "starts-with"}:      {Fn: startsWith, NArgs: 2},
	{Local: "contains"}:         {Fn: contains, NArgs: 2},
	{Local: "substring-before"}: {Fn: substringBefore, NArgs: 2},
	{Local: "substring-after"}:  {Fn: substringAfter, NArgs: 2},
	{Local: "substring"}:        {Fn: substring, NArgs: 3, LastArgOpt: tree.Optional},
	{Local: "string-length"}:    {Fn: stringLength, NArgs: 1, LastArgOpt: tree.Optional},
	{Local: "normalize-space"}:  {Fn: normalizeSpace, NArgs: 1, LastArgOpt: tree.Optional},
	{Local: "translate"}:        {Fn: translate, NArgs: 3},
	//Node set functions
	{Local: "last"}:          {Fn: last},
	{Local: "position"}:      {Fn: position},
	{Local: "count"}:         {Fn: count, NArgs: 1},
	{Local: "local-name"}:    {Fn: localName, NArgs: 1, LastArgOpt: tree.Optional},
	{Local: "namespace-uri"}: {Fn: namespaceURI, NArgs: 1, LastArgOpt: tree.Optional},
	{Local: "name"}:          {Fn: name, NArgs: 1, LastArgOpt: tree.Optional},
	//boolean functions
	{Local: "boolean"}: {Fn: boolean, NArgs: 1},
	{Local: "not"}:     {Fn: not, NArgs: 1},
	{Local: "true"}:    {Fn: _true},
	{Local: "false"}:   {Fn: _false},
	{Local: "lang"}:    {Fn: lang, NArgs: 1},
	//number functions
	{Local: "number"}:  {Fn: number, NArgs: 1, LastArgOpt: tree.Optional},
	{Local: "sum"}:     {Fn: sum, NArgs: 1},
	{Local: "floor"}:   {Fn: floor, NArgs: 1},
	{Local: "ceiling"}: {Fn: ceiling, NArgs: 1},
	{Local: "round"}:   {Fn: round, NArgs: 1},
}