title: How to use a dynamic path expression in Xquery
body: <p>I'm fairly new to xquery so please bear with me as I try to best ask this question.</p>
  
  <p>when i use the following statement (to select a sequence) it works just fine:</p>
  
  <pre><code>let $parts := doc("soap.xml")/soapenv:Envelope/soapenv:Body/ns0:PartDetails/ns0:partName
  </code></pre>
  
  <p>this loads all elements (as a sequence) into the $parts variable just how i'd like but...</p>
  
  <p>i want to assign the "<code>/ns0:partName</code>" <strong>dynamically</strong>. I went thru all the Qname functions thinking they'd somehow help but no such luck. after 2 days of struggling i'm hoping one of you can point me in the right direction. </p>