<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
	<xsl:output method="xml" indent="yes"/>

    <xsl:template match="/">
      <xsl:apply-templates />
    </xsl:template>
    
	<xsl:template match="jsdoc">
    <xsl:variable name="name" select="substring(fileName, 0, string-length(fileName) - 3)" />
<document url="{$name}.html">
    <xsl:variable name="title">
      <xsl:if test="title"><xsl:value-of select="title" /></xsl:if>
      <xsl:if test="not(title)"><xsl:value-of select="concat('File ',fileName)" /></xsl:if>
    </xsl:variable>
  <xsl:comment>
    WARNING: This file is automatically generated from a jsdoc processor that
    turns javadoc-type comments of Javascript and special Java files into an xml file, which is
    then processed by an xsl file to create this document. Do not modify this
    file, but rather either modify the comments or xsl file.
  </xsl:comment>
  <properties>
    <title><xsl:value-of select="title" /></title>
  </properties>
  <body>
   
    <section name="{title}" href="summary">
      <p>
        <xsl:value-of select="comment/text" disable-output-escaping="yes"/>
      </p>
      <dl>
      <xsl:apply-templates select="comment/author" />
      <xsl:apply-templates select="comment/version" />
      <xsl:apply-templates select="comment/see" />
      </dl>
      <xsl:if test="property">
        <table width="100%">
          <tr>
            <th colspan="2">Property Summary</th>
          </tr>
          <xsl:for-each select="property">
          <tr>
            <td width="5%"><code><xsl:value-of select="type" /></code></td>
            <td>
              <strong><code><a href="#{concat('prop_',name)}"><xsl:value-of select="name" /></a></code></strong>
              <xsl:if test="comment/firstSentence">
                <dd><xsl:value-of select="comment/firstSentence" disable-output-escaping="yes" /></dd>
              </xsl:if>
            </td>
          </tr>
        </xsl:for-each>
        </table>
        <br />
      </xsl:if>  
      <xsl:if test="function">
        <table width="100%">
          <tr>
            <th colspan="2">Function Summary</th>
          </tr>
          <xsl:for-each select="function">
          <tr>
            <td width="5%"><code><xsl:value-of select="type" /></code></td>
            <td>
              <strong><code><a href="#{concat('fn_',name)}"><xsl:value-of select="concat(name,'(',args,')')" /></a></code></strong>
              <xsl:if test="comment/firstSentence">
                <dd><xsl:value-of select="comment/firstSentence"  disable-output-escaping="yes"/></dd>
              </xsl:if>
            </td>
          </tr>
        </xsl:for-each>
        </table>
      </xsl:if>
    </section>
    <xsl:if test="property">
      <section name="Properties">
        <xsl:apply-templates select="property" />
      </section>
    </xsl:if>
    <xsl:if test="function">
      <section name="Functions">
        <xsl:apply-templates select="function" />
      </section>
    </xsl:if>
  </body>
</document>
    </xsl:template>
    
    <xsl:template match="author">
      <dt><strong>Author: </strong></dt><dd><xsl:value-of select="."  disable-output-escaping="yes" /></dd>
    </xsl:template>
    
    <xsl:template match="see">
      <dt><strong>See Also: </strong></dt><dd><xsl:value-of select="."  disable-output-escaping="yes"/></dd>
    </xsl:template>
    
    <xsl:template match="version">
      <dt><strong>Version: </strong></dt><dd><xsl:value-of select="." /></dd>
    </xsl:template>
    
    <xsl:template match="return">
      <dt><strong>Returns: </strong></dt><dd><xsl:value-of select="."  disable-output-escaping="yes"/></dd>
    </xsl:template>
    
    <xsl:template match="example">
      <dt><strong>Example: </strong></dt><dd>
<pre>
<xsl:value-of select="."  disable-output-escaping="yes"/>
</pre></dd>
    </xsl:template>

    <xsl:template match="function">
      <section name="{name}" href="fn_{name}">
<pre>
    <xsl:value-of select="concat(type,' ',name,'(',args,')')" />
</pre>
          <p><xsl:value-of select="comment/text" disable-output-escaping="yes"/>
          </p>
          <xsl:if test="comment/param">
          <dl>
            <dt><strong>Parameters:</strong></dt>
              <xsl:for-each select="comment/param">
              <dd>
                <code><xsl:value-of select="name" /></code> - 
                <xsl:value-of select="description"  disable-output-escaping="yes"/>
              </dd>
              </xsl:for-each>
            </dl>
          </xsl:if>
          <dl>
            <xsl:apply-templates select="comment/return" />
            <xsl:apply-templates select="comment/version" />
            <xsl:apply-templates select="comment/see" />
            <xsl:apply-templates select="comment/throws" />
            <xsl:apply-templates select="comment/example" />
          </dl>
      </section>
    </xsl:template>
    
    <xsl:template match="property">
      <section name="{name}" href="prop_{name}">
<pre>
    <xsl:value-of select="concat(type,' ',name)" />
</pre>
          <p><xsl:value-of select="comment/text" disable-output-escaping="yes"/>
          </p>
      </section>
    </xsl:template>
        
    <xsl:template match="text()" />
    
</xsl:stylesheet>
