<html xmlns:py="http://genshi.edgewall.org/" 
  xmlns:xi="http://www.w3.org/2001/XInclude"
  py:strip=""
  >
  <py:def function="page_title">SPARQL Endpoint</py:def>
  <py:def function="optional_head">
    <py:for each="style in c.stylesheets">
      <link rel="stylesheet" href="${style}" type="text/css" />
    </py:for>
  </py:def>
  <py:def function="subnav">
    <li>SPARQL Endpoint</li>
  </py:def>
  <div py:match="content">  
    <form method="get" action="/sparql">
      <div>
        <textarea name="query" cols="80" rows="15">${c.query}</textarea>
        <br />
        <input type="submit" value="Run Query" />
      </div>
    </form>
    
    <py:if test="c.warnings">
      <div id="warnings">
        <ul>
          <py:for each="warning in c.warnings"> 
            <li><pre>${warning}</pre></li>
          </py:for>
        </ul>
      </div>
    </py:if> 

    <py:if test="c.bindings"> 
      <table width="100%" border="1">
        <tr>
          <py:for each="b in c.bindings">   
            <th>${b}</th>
          </py:for>
        </tr>
        <py:for each="row in c.results">
          <tr>
            <py:for each="b in c.bindings">
              <td>${h.literal(h.render_html(row[b]))}</td>
            </py:for> 
          </tr>
        </py:for> 
      </table>
    </py:if> 
    <py:if test="hasattr(c, 'content')">
      ${c.content}
    </py:if>
  </div>
  <xi:include href="base.html" /> 
</html>
