Loading TOC...

MarkLogic Server 11.0 Product Documentation
cts:valid-optic-path

cts:valid-optic-path(
   $string as xs:string,
   [$map as map:map?]
) as xs:boolean

Summary

Parses path expressions and resolves namespaces using the $map parameter. Support built in functions inside path since ML 11.0.0. Returns true if the argument is permissible as a path for Optic op:xpath

Parameters
string The path to be tested as a string.
map A map of namespace bindings. The keys should be namespace prefixes and the values should be namespace URIs. These namespace bindings will be added to the in-scope namespace bindings in the evaluation of the path.

Example

  cts:valid-optic-path("/foo/bar[@baz = '1']")
  => true

Example

  xquery version "1.0-ml";
  let $namespaces := map:map()
  let $_ := map:put($namespaces, "ns1", "http://example.org/myns")
  return cts:valid-optic-path("/ns1:foo/ns1:bar[@baz = '1']",$namespaces)
  => true

Example

  xquery version "1.0-ml";
  cts:valid-optic-path("/foo/bar[@baz = '1']/fn:string(.)")
  => true

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.