func ValueToXPathObject(val interface{}) (ret C.xmlXPathObjectPtr) {
	if val == nil {
		ret = C.xmlXPathNewNodeSet(nil)
		return
	}
	switch v := val.(type) {
	case unsafe.Pointer:
		return (C.xmlXPathObjectPtr)(v)
	case []unsafe.Pointer:
		ptrs := v
		if len(ptrs) > 0 {
			ret = C.xmlXPathNewNodeSet(nil)
			for _, p := range ptrs {
				C.xmlXPathNodeSetAdd(ret.nodesetval, (*C.xmlNode)(p))
			}
		} else {
			ret = C.xmlXPathNewNodeSet(nil)
			return
		}
	case float64:
		ret = C.xmlXPathNewFloat(C.double(v))
	case string:
		xpathBytes := GetCString([]byte(v))
		xpathPtr := unsafe.Pointer(&xpathBytes[0])
		ret = C.xmlXPathNewString((*C.xmlChar)(xpathPtr))
	default:
		typ := reflect.TypeOf(val)
		if typ.Kind() == reflect.Ptr {
			typ = typ.Elem()
		}
		ret = C.xmlXPathNewNodeSet(nil)
	}
	return
}
Convert an arbitrary value into a C.xmlXPathObjectPtr
Unrecognised and nil values are converted to empty node sets.
package xpath
import "C"
import "unsafe"
import "reflect"
import . "github.com/moovweb/gokogiri/util"
func go_resolve_variables(ctxt unsafe.Pointer, name, ns *C.char) (ret C.xmlXPathObjectPtr) {
	variable := C.GoString(name)
	namespace := C.GoString(ns)
	context := (*VariableScope)(ctxt)
	if context != nil {
		val := (*context).ResolveVariable(variable, namespace)
		ret = ValueToXPathObject(val)
	}
	return
}