title: XQuery : use XQuery data in javascript function?
body: <p>My problem is the following. I declared at top of my xquery file a sequence containing some locations :</p>
  
  <pre><code>xquery version "1.0";
  declare option exist:serialize "method=xhtml media-type=text/html";
  let $locations := //location
  return
  </code></pre>
  
  <p>Then I have a javascript code in my <code>&lt;head&gt;</code> that displays a map using Google Maps API. What I want to know is how to use my xquery variable <code>$locations</code> in my javascript function to display markers on my map ?</p>
  
  <p>I used the code from <a href="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/examples/simple_example.html" rel="nofollow">http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/examples/simple_example.html</a> :</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  &lt;!--
  function initialize() {
      var center = new google.maps.LatLng(43.700,7.267);
  
      var map = new google.maps.Map(document.getElementById('map'), {
        zoom:12,
        center: center,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      });
  
      var markers = [];
      for (var i = 0; i &lt; 100; i++) {
        var dataPhoto = data.photos[i];
        var latLng = new google.maps.LatLng(dataPhoto.latitude,
            dataPhoto.longitude);
        var marker = new google.maps.Marker({
          position: latLng
        });
        markers.push(marker);
      }
      var markerCluster = new MarkerClusterer(map, markers);
    }
    google.maps.event.addDomListener(window, 'load', initialize);
  --&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>And of course in my html source :</p>
  
  <pre><code>&lt;html&gt;
     &lt;div id="map-container"&gt;&lt;div id="map"&gt;&lt;/div&gt;&lt;/div&gt;
  &lt;html&gt;
  </code></pre>