📄 api.xsl
字号:
<!--
Updated 020217: Added support for global functions and objects and tried to clean it
up a notch
020527 Added support for extends attribute in class element.
Added support for internal links
Fixed white space issues after "Read only." and "Optional."
020528 Added support for br tags
020529 Added events section
Added support for br in syntax section
030310 Modified for Bindows
030717 Added doctype info to xsl:output
$website flag
TODO: Add example... to class template
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="headerText">
Generated using api.website.xsl version 2003-07-17
</xsl:variable>
<xsl:output
method="html"
omit-xml-declaration="yes"
encoding="utf-8"
doctype-public="-//W3C//DTD HTML 4.01//EN"
doctype-system="http://www.w3.org/TR/html4/strict.dtd"
/>
<xsl:param name="baseDir" select="''"/>
<xsl:param name="extension" select="'.xml'"/>
<xsl:param name="website" select="false()"/>
<xsl:variable name="classTree" select="document('classtree.xml')"/>
<xsl:variable name="className" select="/class/@name"/>
<!-- Main -->
<xsl:template match="/">
<xsl:if test="$website">
<html>
<xsl:comment><xsl:value-of select="$headerText"/></xsl:comment>
<head>
<title>Bindows™ / API / <xsl:value-of select="/class/@name"/></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--<link type="text/css" rel="stylesheet" href="api.css" />-->
<link type="text/css" rel="stylesheet" media="screen, projection, print" href="../../css/style.css"/>
<script type="text/javascript" src="../../js/include.js"></script>
<script type="text/javascript">layout.init("../../");</script>
<script type="text/javascript">
function showDerivedClasses() {
var ul = document.getElementById("api-derived-classes");
var lis = ul.childNodes;
var l = lis.length;
for (var i = 1; i < l; i++)
lis[i].style.display = "";
lis[0].style.display = "none";
}
</script>
</head>
<body>
<script type="text/javascript">layout.writeHeader("<xsl:value-of select="/class/@name"/>");</script>
<script type="text/javascript">layout.inApi=true;layout.writeNavigationBar();</script>
<div class="main api">
<xsl:apply-templates select="//class"/>
</div>
<script type="text/javascript">layout.writeFooter()</script>
</body>
</html>
</xsl:if>
<xsl:if test="not($website)">
<html>
<xsl:comment><xsl:value-of select="$headerText"/></xsl:comment>
<head>
<title>
<xsl:value-of select="/class/@name"/></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="api.css" />
<script type="text/javascript">
function showDerivedClasses() {
var ul = document.getElementById("api-derived-classes");
var lis = ul.childNodes;
var l = lis.length;
for (var i = 1; i < l; i++)
lis[i].style.display = "";
lis[0].style.display = "none";
}
</script>
</head>
<body>
<xsl:apply-templates select="//class"/>
</body>
</html>
</xsl:if>
</xsl:template>
<xsl:template match="class">
<xsl:if test="not($website)">
<h1 id="{@name}"><xsl:value-of select="@name"/></h1>
</xsl:if>
<xsl:if test="@retailOnly">
<p class="warning">
<code><xsl:value-of select="@name"/></code> is only available in the retail version.</p>
</xsl:if>
<p><xsl:call-template name="descriptionTemplate"/></p>
<xsl:if test="@extends">
<p>This class extends
<xsl:call-template name="linkTemplate">
<xsl:with-param name="class" select="@extends"/>
<xsl:with-param name="text" select="@extends"/>
</xsl:call-template>
and therefore all methods and fields available for
<xsl:call-template name="linkTemplate">
<xsl:with-param name="class" select="@extends"/>
<xsl:with-param name="text" select="@extends"/>
</xsl:call-template>
are also available for <code><xsl:value-of select="@name"/></code>.</p>
</xsl:if>
<xsl:call-template name="outputClassTree"/>
<h2>Constructor</h2>
<xsl:choose>
<xsl:when test="syntax">
<pre><xsl:apply-templates select="syntax"/></pre>
</xsl:when>
<xsl:otherwise>
<p><code><xsl:call-template name="constructSyntax"/></code></p>
</xsl:otherwise>
</xsl:choose>
<h3>Parameters</h3>
<xsl:apply-templates select="arguments">
<xsl:with-param name="noText">No parameters.</xsl:with-param>
</xsl:apply-templates>
<h2>Properties</h2>
<xsl:call-template name="propertiesListTemplate">
<xsl:with-param name="properties" select="properties/property"/>
</xsl:call-template>
<h2>Methods</h2>
<xsl:call-template name="methodListTemplate">
<xsl:with-param name="methods" select="methods/method" />
</xsl:call-template>
<h2>Events</h2>
<xsl:call-template name="eventListTemplate">
<xsl:with-param name="events" select="events/event" />
</xsl:call-template>
<h2>Static Methods</h2>
<xsl:call-template name="methodListTemplate">
<xsl:with-param name="methods" select="staticMethods/method"/>
</xsl:call-template>
<h2>Static Fields</h2>
<xsl:call-template name="fieldListTemplate">
<xsl:with-param name="fields" select="staticFields/field"/>
</xsl:call-template>
<h2>Remarks</h2>
<p>
<xsl:choose>
<xsl:when test="remarks/text()">
<xsl:apply-templates select="remarks"/>
</xsl:when>
<xsl:otherwise>None.</xsl:otherwise>
</xsl:choose>
</p>
<!-- Method Details -->
<xsl:if test="methods/method">
<h2>Method Details</h2>
<xsl:apply-templates select="methods/method" mode="details">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:if>
<!-- Static Method Details -->
<xsl:if test="staticMethods/method">
<h2>Static Method Details</h2>
<xsl:apply-templates select="staticMethods/method" mode="details">
<xsl:with-param name="static" select="true()"/>
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<!-- Named Templates -->
<!--
returns text from description attribute if present
if not present then the template returns the text of a child
element called description
-->
<xsl:template name="descriptionTemplate">
<xsl:choose>
<xsl:when test="@description">
<xsl:value-of select="@description"/>
</xsl:when>
<xsl:otherwise>
<!--<xsl:value-of select="description"/>-->
<xsl:apply-templates select="description"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="typeTemplate">
<code class="type"><xsl:choose>
<xsl:when test="@type">
<xsl:value-of select="@type"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="type"/>
</xsl:otherwise>
</xsl:choose></code>
</xsl:template>
<xsl:template name="methodListTemplate">
<xsl:param name="methods"/>
<xsl:choose>
<xsl:when test="not($methods)">
<p>None.</p>
</xsl:when>
<xsl:otherwise>
<table>
<thead>
<tr>
<td>Name</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="$methods" mode="list">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</tbody>
</table>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="fieldListTemplate">
<xsl:param name="fields"/>
<xsl:choose>
<xsl:when test="not($fields)">
<p>None.</p>
</xsl:when>
<xsl:otherwise>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="$fields">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</tbody>
</table>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="propertiesListTemplate">
<xsl:param name="properties"/>
<xsl:choose>
<xsl:when test="not($properties)">
<p>None.</p>
</xsl:when>
<xsl:otherwise>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="get-header">get</td>
<td class="set-header">set</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="$properties">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</tbody>
</table>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="eventListTemplate">
<xsl:param name="events"/>
<xsl:choose>
<xsl:when test="not($events)">
<p>None.</p>
</xsl:when>
<xsl:otherwise>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="bubbles-header">Bubbles</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="$events">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</tbody>
</table>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -