title: grab data from xml file
body: <p>i have below 2 xml file(fruit.xml and toy.xml).I wanted to use xquery to retrieve the fruit and toy that is produce by the country Japan.</p>
  
  <p>the expected result should be like below toys need to be list out first before the fruit.</p>
  
  <pre><code> &lt;JapanProduct&gt;
      &lt;Prod type="Toy"&gt;Digimon&lt;Prod&gt;
      &lt;Prod type="Toy"&gt;Doll&lt;Prod&gt;
      &lt;Prod type="Fruit"&gt;Peach&lt;Prod&gt;
  &lt;/JapanProduct&gt;
  </code></pre>
  
  <p>below is the xquery code that i wrote and is currently stuck here.how can i produce the expected result as above?</p>
  
  <pre><code>for $f in doc("Fruit.xml")//Produce
  for $t in doc("Toy.xml")//Produce
  
  where $f[Country="Japan"] and $t[Country="Japan"]
  return element JapanProduct {attribute Prod{if ($f[country=Japan"])then }
  </code></pre>
  
  <p></p>
  
  <pre><code>Fruit.XML
  &lt;fruitsOrigin&gt;
    &lt;Produce&gt;      
       &lt;Country&gt;Australia&lt;/Country&gt;
       &lt;Prod&gt;Kiwi&lt;/Prod&gt;
       &lt;Size&gt;M&lt;/Size&gt;
    &lt;/Produce&gt;
    &lt;Produce&gt;
       &lt;Country&gt;China&lt;/Country&gt;
       &lt;Prod&gt;Pear&lt;/Prod&gt;
       &lt;Size&gt;M&lt;/Size&gt;    
    &lt;/Produce&gt;
    &lt;Produce&gt;
       &lt;Country&gt;Japan&lt;/Country&gt;
       &lt;Prod&gt;Peach&lt;/Prod&gt;
       &lt;Size&gt;L&lt;/Size&gt; 
    &lt;/Produce&gt;   
  &lt;/fruitsOrigin&gt;
  
  Toy.XML
  &lt;ToyMaker&gt;
     &lt;Produce&gt;
       &lt;Country&gt;Australia&lt;/Country&gt;
       &lt;Prod&gt;Lego&lt;/Prod&gt;
       &lt;cost&gt;$15&lt;/cost&gt;
     &lt;/Produce&gt;
     &lt;Produce&gt;
       &lt;Country&gt;Japan&lt;/Country&gt;
       &lt;Prod&gt;Doll&lt;/Prod&gt;
       &lt;cost&gt;$20&lt;/cost&gt;      
     &lt;/Produce&gt;
     &lt;Produce&gt;
       &lt;Country&gt;Japan&lt;/Country&gt;
       &lt;Prod&gt;Digimon&lt;/Prod&gt;
       &lt;cost&gt;$17&lt;/cost&gt;
     &lt;/Produce&gt;
  &lt;/ToyMaker&gt;
  </code></pre>