<?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; font-size: 30pt}
	  input { font-family: sans-serif; font-size: 30pt; width: 15em}
	  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}
	</style> 

	<model xmlns="http://www.w3.org/2002/xforms">
	    <instance>
		<data xmlns="">
		    <zoom>10</zoom><x/><y/><url/><posx>130980</posx><posy>87168</posy><scale/><maxpos/>
		</data>
	    </instance>
	    <bind nodeset="scale" calculate="power(2, 18 - ../zoom)"/>
	    <bind nodeset="maxpos" calculate="power(2, 18)-1"/>
	    <bind nodeset="x" calculate="floor(../posx div ../scale)"/>
	    <bind nodeset="y" calculate="floor(../posy div ../scale)"/>
	    <bind nodeset="url"
		  calculate="concat('http://a.tile.openstreetmap.org/', ../zoom, '/' , ../x, '/', ../y, '.png')"/>
	</model>
</head>
<body>
    <group xmlns="http://www.w3.org/2002/xforms">
        <div>
	    <input ref="zoom" /><h:br/>
	    <input ref="posx" /><h:br/>
	    <input ref="posy" /><h:br/>
	    <output ref="x" /><h:br/>
	    <output ref="y" /><h:br/>
	    <output ref="url" mediatype="image/*" />
	</div>
    </group>
</body>
</html>
