Q:

string in xpath

I have a string and I want to use  it as a selector in xpath to select a node with name as value of the string.
declare variable $get_count := <count><comedy>1</comedy></count>;
(: $string = "comedy" :)
 let $value =  $get_count/$string (: but this doesn't return anything)

How shall i do it?

A:

let $value =  $get_count/$string (: but this doesn't return anything) 

Use:
declare variable $get_count := <count><comedy>1</comedy></count>;
declare variable $string := "comedy";

 let $value :=  $get_count/*[name()=$string]
  return 
    $value

When this is applied on any XML document (not used), the wanted, correct result is produced:
<comedy>1</comedy>

