<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../xsltforms/xsltforms.xsl" type="text/xsl"?>
<?xsltforms-options debug="no"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://www.w3.org/1999/xhtml"
      xmlns:xf="http://www.w3.org/2002/xforms"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<head>
	<title>Open Street Map</title>

	<style type="text/css">
	  body { font-family: sans-serif; margin-left: 5em; margin-top: 5em; width: 50em}
          pre { margin-left: 3em; background-color: #ddddFF; border: thin black solid }
	  label { display: inline-block; width: 3em; margin: 0 1em }
          .xforms-repeat-item-selected { background: yellow}
	  div.map { line-height: 0}
	  .small .value img {height: 1cm; width: 1cm}
	  .xforms-input {display: block}
	</style> 

	<model xmlns="http://www.w3.org/2002/xforms">
	    <instance>
		<data xmlns="">
		    <zoom>10</zoom>
		    <x>511</x>
		    <y>340</y>
		    <url/>
		</data>
	    </instance>
	    <bind nodeset="url"
		  calculate="concat('http://a.tile.openstreetmap.org/', ../zoom, '/' , ../x, '/', ../y, '.png')"/>
	</model>
</head>
<body>
<p><a href="osm3.xml">NEXT</a> | <a href="osm1.xml">PREV</a></p>
<p>An OSM URL is made up as:
http://&lt;site&gt;/&lt;zoom&gt;/&lt;x&gt;/&lt;y&gt;.png</p>
<p>So we can represent that in the XForms data:</p>
<pre>     &lt;instance>
        &lt;data xmlns="">
           <strong>&lt;zoom>10&lt;/zoom>
	   &lt;x>511&lt;/x>
	   &lt;y>340&lt;/y>
	   &lt;url/></strong>
	&lt;/data>
     &lt;/instance>
</pre>
<p>And we calculate the url:</p>
<pre>     &lt;bind nodeset="url"
	calculate="concat('http://a.tile.openstreetmap.org/',
                            ../zoom, ../x, '/', ../y, '.png')"/>
</pre>
<p>and we can input the different parts:</p>
<pre>     &lt;input ref="zoom">&lt;label>zoom&lt;/label>&lt;/input>
</pre>
<p>etc. Like this:</p>
    <group xmlns="http://www.w3.org/2002/xforms">
      <input ref="zoom"><label>zoom</label></input>
      <input ref="x"><label>x</label></input>
      <input ref="y"><label>y</label></input>
      <output ref="url"/><h:br/>
    
      <h:div class="map">
	<output ref="url" mediatype="image/*" />
      </h:div>
    </group>
</body>
</html>
