title: How to root element dynamically provide in cts:search using Marklogic
body: <p>After using the below mentioned Xquery I am getting the output correctly.</p>
  
  <pre><code>let $element :="Name"
  let $value := "Antony"
  let $op :=  cts:search(//root, cts:element-value-query( xs:QName($element),$value))
  return $op
  </code></pre>
  
  <p>But I am getting error while using "<strong>root</strong>" value in variable. Please suggest me, if any other options?</p>
  
  <pre><code>let $element := "Name"
  let $value := "Antony"
  let $root := "root"
  let $op := cts:search(//$root, cts:element-value-query( xs:QName($element),$value))
  return $op 
  </code></pre>
  
  <p>Error :</p>
  
  <pre><code>[1.0-ml] XDMP-UNSEARCHABLE: cts:search(fn:collection()/descendant-or-self::node()/"root", cts:element-value-query(fn:QName("","Name"), "Antony", ("lang=en"), 1)) -- Expression is unsearchable
  
  Stack Trace
  At line 16 column 23:
  
  In xdmp:eval("(:&amp;#10; let $uri := cts:element-value-query( xs:QName(&amp;quot;file...", (), &lt;options xmlns="xdmp:eval"&gt;&lt;database&gt;8922589838473153050&lt;/database&gt;&lt;root&gt;/marklogic/poc/&lt;/r...&lt;/options&gt;)
  
  $element := "Name"
  $value := "Antony"
  $root := "root"
  
  14. let $value := "Antony"
  15. let $root :="root"
  16. **let $op := cts:search(//$root, cts:element-value-query( xs:QName($element),$value))**
  17. return $op 
  </code></pre>
  
  <p>Example data:</p>
  
  <pre><code>&lt;root processtype="sample"&gt;
    &lt;title series="hk"&gt;
      &lt;Name&gt;Antony&lt;/Name&gt;
    &lt;/title&gt;
  &lt;/root&gt;
  </code></pre>