<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:zi="http://zero-install.sourceforge.net/2004/injector/interface"
		version="1.0">

  <xsl:output method="html" encoding="utf-8"
	doctype-system="http://www.w3.org/TR/html4/strict.dtd"
	doctype-public="-//W3C//DTD HTML 4.01//EN"/>

  <xsl:param name='file'/>

  <xsl:template match="/zi:interface">
    <html>
      <head>
        <title>
          <xsl:value-of select="zi:name"/>
        </title>
	<link rel='stylesheet' type='text/css' href='../../../../style.css'/>
      </head>
      <body>
	<h1><a href='/0mirror'>Roscidus.com Zero Install Mirror</a></h1>

       <div class='main'>
	 <p>» <a href='/0mirror/'>Main</a> » <span class='breadcrumb'><xsl:value-of select='zi:name'/></span></p>

	<h2><xsl:value-of select="zi:name"/> - <xsl:value-of select='zi:summary'/></h2>

	<xsl:apply-templates select='document($file)/metadata'/>

	<dl>
	 <dt>Overview</dt>
	 <dd>
	 <xsl:choose>
	 <xsl:when test='//zi:implementation[@main] | //zi:group[@main]'>
	  <p>This is a Zero Install feed. To add this program to your Applications menu, choose
	  <b>Zero Install -> Add New Program</b> from the <b>Applications</b> menu. e.g. on Ubuntu:</p>
	  <p style='text-align: center'>
	    <img width="335" height="259" src="http://0install.net/tutorial/add-with-gnome.png" alt='Adding with GNOME'/>
	  </p>
	  <p>If you don't see this menu item, install the <b>zeroinstall-injector</b> package from your
	  distribution's repository, or from <a href='http://0install.net/injector.html'>0install.net</a>.</p>

	  <p>
	  Drag <a href='{/zi:interface/@uri}'>the feed's URL</a> to the dialog box that appears.
	  Other environments may use other systems. For example, if you are a ROX desktop user, drag
	  the link to <a href='http://rox.sourceforge.net/desktop/AddApp'>AddApp</a> instead.
	  </p>

	  <p>Alternatively, to run it from the command-line:</p>
	  <pre>$ 0launch <xsl:value-of select='/zi:interface/@uri'/></pre>
	  <p>
	  The <b>0alias</b> command can be used to create a short-cut to run it again later.
	  </p>
	  <p>
	  If you don't have the <b>0launch</b> command, download it from
	  <a href='http://0install.net/injector.html'>the 0install.net web-site</a>, which also contains
	  documentation about how the Zero Install system works.</p>
	 </xsl:when>
	 <xsl:otherwise>
	  <p>This is a Zero Install feed.
	  This software cannot be run as an application directly. It is a library for other programs to use.</p>
	  <p>For more information about Zero Install, see <a href='http://0install.net'>0install.net</a>.</p>
	 </xsl:otherwise>
	</xsl:choose>
	</dd>

	  <xsl:apply-templates mode='dl' select='*|@*'/>

	<dt>Available versions</dt>
	<dd>
	  <xsl:choose>
	    <xsl:when test='//zi:implementation|//zi:package-implementation'>
	      <p>The list below is just for information; Zero Install will automatically select one of
	      these versions for you.
	      </p>
	      <xsl:if test='//zi:implementation'>
		<table class='boxtable'>
		  <tr><th>Version</th><th>Released</th><th>Stability</th><th>Platform</th><th>Download</th></tr>
		  <xsl:for-each select='//zi:implementation'>
		    <tr>
		      <td><xsl:value-of select='(ancestor-or-self::*[@version])[last()]/@version'/>
			<xsl:if test='(ancestor-or-self::*[@version])[last()]/@version-modifier'><xsl:value-of select='(ancestor-or-self::*[@version])[last()]/@version-modifier'/></xsl:if>
		      </td>
		      <td><xsl:value-of select='(ancestor-or-self::*[@released])[last()]/@released'/></td>
		      <td><xsl:value-of select='(ancestor-or-self::*[@stability])[last()]/@stability'/></td>
		      <td>
			<xsl:variable name='arch' select='(ancestor-or-self::*[@arch])[last()]/@arch'/>
			<xsl:choose>
			  <xsl:when test='$arch = "*-src"'>Source code</xsl:when>
			  <xsl:when test='not($arch)'>Any</xsl:when>
			  <xsl:otherwise><xsl:value-of select='$arch'/></xsl:otherwise>
			</xsl:choose>
		      </td>
		      <td>
			<xsl:for-each select='.//zi:archive'>
			  <a href='{@href}'>Download</a> (<xsl:value-of select='@size'/> bytes)
			</xsl:for-each>
		      </td>
		    </tr>
		  </xsl:for-each>
		</table>
	      </xsl:if>
	      <xsl:if test='//zi:package-implementation'>
		<p>Non-Zero Install packages provided distributions can also provide this interface:</p>
		<table class='boxtable'>
		  <tr><th>Distribution</th><th>Package name</th></tr>
		  <xsl:for-each select='//zi:package-implementation'>
		    <tr>
		      <td><xsl:value-of select='(ancestor-or-self::*[@distributions])[last()]/@distributions'/>
		      </td>
		      <td><xsl:value-of select='(ancestor-or-self::*[@package])[last()]/@package'/></td>
		    </tr>
		  </xsl:for-each>
		</table>
	      </xsl:if>
	    </xsl:when>
	    <xsl:otherwise>
	      <p>No versions are available for downlad.</p>
	    </xsl:otherwise>
	  </xsl:choose>
	</dd>

	<dt>Required libraries</dt>
	<dd>
	 <xsl:choose>
	   <xsl:when test='//zi:requires'>
	     <p>The list below is just for information; Zero Install will automatically download any required
	     libraries for you.
	     </p>
	      <ul>
	       <xsl:for-each select='//zi:requires'>
	         <xsl:variable name='interface' select='@interface'/>
		 <xsl:if test='not(preceding::zi:requires[@interface = $interface])'>
	           <li><a><xsl:attribute name='href'><xsl:value-of select='$interface'/></xsl:attribute><xsl:value-of select='$interface'/></a></li>
		 </xsl:if>
	       </xsl:for-each>
	      </ul>
	    </xsl:when>
	    <xsl:otherwise>
	      <p>This feed does not list any additional requirements.</p>
	    </xsl:otherwise>
	  </xsl:choose>
	</dd>
	</dl>
       </div>
      </body>
    </html>
  </xsl:template>
  
  <xsl:template mode='dl' match='/zi:interface/@uri'>
    <dt>Full name</dt><dd><p><a href='{.}'><xsl:value-of select="."/></a></p></dd>
  </xsl:template>

  <xsl:template mode='dl' match='zi:homepage'>
    <dt>Homepage</dt><dd><p><a href='{.}'><xsl:value-of select="."/></a></p></dd>
  </xsl:template>

  <xsl:template mode='dl' match='zi:description'>
    <dt>Description</dt><dd><p><xsl:value-of select="."/></p></dd>
  </xsl:template>

  <xsl:template mode='dl' match='zi:icon'>
    <dt>Icon</dt><dd><p><img src='{@href}'/></p></dd>
  </xsl:template>

  <xsl:template mode='dl' match='*|@*'/>

  <xsl:template match='zi:group'>
    <dl class='group'>
      <xsl:apply-templates mode='attribs' select='@stability|@version|@id|@arch|@released'/>
      <xsl:apply-templates select='zi:group|zi:requires|zi:implementation'/>
    </dl>
  </xsl:template>

  <xsl:template match='zi:requires'>
    <dt>Requires</dt>
    <dd><a href='{@interface}'><xsl:value-of select='@interface'/></a></dd>
  </xsl:template>

  <xsl:template match='zi:implementation'>
    <dl class='impl'>
      <xsl:apply-templates mode='attribs' select='@stability|@version|@id|@arch|@released'/>
      <xsl:apply-templates/>
    </dl>
  </xsl:template>

  <xsl:template mode='attribs' match='@*'>
    <dt><xsl:value-of select='name(.)'/></dt>
    <dd><xsl:value-of select='.'/></dd>
  </xsl:template>

  <xsl:template match='zi:archive'>
    <dt>Download</dt>
    <dd><a href='{@href}'><xsl:value-of select='@href'/></a>
    (<xsl:value-of select='@size'/> bytes)</dd>
  </xsl:template>

  <xsl:template match='*[name()="metadata"]'>
    <xsl:if test='@active="False"'><strong>This feed is no longer available upstream. It is recorded here for historical interest only.</strong></xsl:if>
    <xsl:for-each select='signer'>
      <xsl:choose>
	<xsl:when test='@error'>
	  <p><strong>Error in signature: <xsl:value-of select='@error'/></strong></p>
	</xsl:when>
	<xsl:otherwise>
	  <p>Published by <a href='/0mirror/users/{@user}/user.html'><xsl:value-of select='@name'/></a></p>
	</xsl:otherwise>
      </xsl:choose>
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>

