title: Getting location of XML document in XQuery
body: <p>I'm using Oxygen XML to to work with an XML file that contains references to other XML files. These other XML files are stored in a subdirectory of the directory that contains the main XML file.</p>
  
  <pre><code>Downloads/
  directory1/
    main.xml
    subdirectory1/
      other1.xml
      other2.xml
  </code></pre>
  
  <p>The locations of the other XML files are stored as relative links within the main file. My query looks like something this:</p>
  
  <pre><code>for $df in /clldata/DiscussionForums/DiscussionForum
      let $href := replace(data($df/@href),"\\","/")
      for $p in doc($href)
  return $p
  </code></pre>
  
  <p>The problem I've run into is that Oxygen uses the path to the xquery file as the base for the relative path, obviously resulting in file not found errors. How can I get the path to the XML document within my query?</p>
  
  <p>Right now I'm just using concat() to prepend the correct path but I want this to be easily reusable. </p>