Binds a value to the context. The type will be ignored if the string is empty.
Context(query_obj, value, type)
QueryClass instance-ID
Value that should be boud to the context
The type will be ignored when the string is empty
The type that is provided to the context, should be one of the standard-types. An alternative way is to parse the document information.
# NOT RUN {
ctxt_query_txt <- "for $t in .//text() return string-length($t)"
ctxt_query <- Query(Session, ctxt_query_txt)
ctxt_txt <- paste0("<xml>",
"<txt>Hi</txt>",
"<txt>World</txt>",
"</xml>")
Context(ctxt_query, ctxt_txt, type = "document-node()")
print(Execute(ctxt_query)) ## returns "2" "5"
ctxt_query_txt <- "for $t in parse-xml(.)//text() return string-length($t)"
Context(ctxt_query, ctxt_txt)
print(Execute(ctxt_query))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab