⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 api.xsl

📁 ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.
💻 XSL
📖 第 1 页 / 共 2 页
字号:

<xsl:template name="noneIfEmpty">
	<xsl:param name="nodes"/>

	<xsl:choose>
		<xsl:when test="$nodes">
			<xsl:value-of select="$nodes"/>
		</xsl:when>
		<xsl:otherwise>
			None.
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>


<xsl:template name="constructSyntax">

	new <xsl:value-of select="@name"/>(<xsl:variable name="optionalArguments" select="0"/>
	<xsl:for-each select="arguments/argument">
		<xsl:if test="position() != 1"> </xsl:if>
		<xsl:if test="@optional"><xsl:if test="position() != 1"><xsl:text disable-output-escaping="yes"> </xsl:text></xsl:if>[</xsl:if>
		<xsl:if test="position() != 1">, </xsl:if>
		<span class="methodArgument"> <xsl:value-of select="@name"/></span>
	</xsl:for-each>
	<xsl:for-each select="arguments/argument/@optional">]</xsl:for-each>)</xsl:template>


<xsl:template name="methodSyntax">
	<xsl:param name="static"/>

	<xsl:variable name="objectName">
		<xsl:choose>
			<xsl:when test="$static"><xsl:value-of select="/class/@name"/>.</xsl:when>
			<xsl:when test="name(.) = 'method'">object.</xsl:when>
			<xsl:otherwise></xsl:otherwise>
		</xsl:choose>
	</xsl:variable>

	<xsl:value-of select="$objectName"/><xsl:value-of select="@name"/>(<xsl:variable name="optionalArguments" select="0"/>
	<xsl:for-each select="arguments/argument">
		<xsl:if test="position() != 1"> </xsl:if>
		<xsl:if test="@optional"><xsl:if test="position() != 1"><xsl:text disable-output-escaping="yes"> </xsl:text></xsl:if>[</xsl:if>
		<xsl:if test="position() != 1">, </xsl:if>
		<span class="methodArgument"> <xsl:value-of select="@name"/></span>
	</xsl:for-each>
	<xsl:for-each select="arguments/argument/@optional">]</xsl:for-each>)</xsl:template>


<xsl:template name="check">
	<img src="check.png" alt="checked"/>
	<!--a-->
</xsl:template>






<!-- Match Templates -->


<xsl:template match="arguments">
	<xsl:param name="noText"/>

	<xsl:choose>
		<xsl:when test="not(argument)">
			<p><xsl:value-of select="$noText"/></p>
		</xsl:when>
		<xsl:otherwise>
			<table>
				<thead>
					<tr>
						<td>Name</td>
						<td>Type</td>
						<td class="optional-header">Optional</td>
						<td>Default</td>
						<td>Descripton</td>
					</tr>
				</thead>
				<tbody>
					<xsl:apply-templates select="argument"/>
				</tbody>
			</table>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template match="arguments/argument">
	<tr>
		<td><code><xsl:value-of select="@name"/></code></td>
		<td><xsl:call-template name="typeTemplate"/></td>
		<td class="optional-column"><xsl:if test="@optional"><xsl:call-template name="check"/></xsl:if></td>
		<td><xsl:if test="@default"><code><xsl:value-of select="@default"/></code></xsl:if></td>
		<td><xsl:call-template name="descriptionTemplate"/></td>
	</tr>
</xsl:template>

<xsl:template match="method" mode="list">
	<tr>
		<td>
			<xsl:call-template name="linkTemplate">
				<xsl:with-param name="field"><xsl:value-of select="@name"/></xsl:with-param>
				<xsl:with-param name="text"><xsl:value-of select="@name"/></xsl:with-param>
			</xsl:call-template>
		</td>
		<td>
			<xsl:call-template name="descriptionTemplate"/>
		</td>
	</tr>
</xsl:template>



<xsl:template match="method" mode="details">
	<xsl:param name="static"/>

	<h3>
		<a name="{@name}"/>
		<xsl:value-of select="@name"/>
	</h3>

	<p><xsl:call-template name="descriptionTemplate"/></p>

	<h4>Syntax</h4>

	<pre class="method-syntax"><xsl:call-template name="methodSyntax">
		<xsl:with-param name="static" select="$static"/>
	</xsl:call-template></pre>

	<h4>Parameters</h4>

	<xsl:apply-templates select="arguments">
		<xsl:with-param name="noText">No arguments.</xsl:with-param>
	</xsl:apply-templates>

	<h4>Return Type</h4>

	<p><xsl:apply-templates select="returns"/></p>

</xsl:template>

<xsl:template match="returns">
	<xsl:call-template name="typeTemplate"/>
</xsl:template>

<xsl:template match="field">
	<tr>
		<td><code><xsl:value-of select="@name"/></code></td>
		<td><xsl:call-template name="typeTemplate"/></td>
		<td><xsl:call-template name="descriptionTemplate"/></td>
	</tr>
</xsl:template>


<xsl:template match="property">
	<tr>
		<td>
			<a name="{@name}"/>
			<code><xsl:value-of select="@name"/></code>
		</td>
		<td><xsl:call-template name="typeTemplate"/></td>
		<td class="get-column"><xsl:if test="@get"><xsl:call-template name="check"/></xsl:if></td>
		<td class="set-column"><xsl:if test="@set"><xsl:call-template name="check"/></xsl:if></td>
		<td><xsl:call-template name="descriptionTemplate"/></td>
	</tr>
</xsl:template>


<xsl:template match="event">
	<tr>
		<td>
			<a name="{@name}"/>
			<code><xsl:value-of select="@name"/></code>
		</td>
		<td><xsl:call-template name="typeTemplate"/></td>
		<td class="bubbles-column"><xsl:if test="@bubbles"><xsl:call-template name="check"/></xsl:if></td>
		<td><xsl:call-template name="descriptionTemplate"/></td>
	</tr>
</xsl:template>


<!--
<xsl:template match="link">
	<a>
		<xsl:attribute name="href"><xsl:if test="not(@external)">#</xsl:if><xsl:value-of select="."/></xsl:attribute>
		<xsl:value-of select="."/>
	</a>
</xsl:template>
-->

<xsl:template match="link">
	<xsl:call-template name="linkTemplate">
		<xsl:with-param name="class" select="@class"/>
		<xsl:with-param name="field" select="@field"/>
		<xsl:with-param name="href" select="@href"/>
		<xsl:with-param name="text" select="."/>
	</xsl:call-template>
</xsl:template>

<xsl:template name="linkTemplate">
	<xsl:param name="class"/>
	<xsl:param name="field"/>
	<xsl:param name="href"/>
	<xsl:param name="text"/>

	<xsl:choose>
		<xsl:when test="$href">
			<a href="{$href}"><xsl:value-of select="$text"/></a>
		</xsl:when>
		<xsl:when test="$class and $field">
			<code>
				<a href="{$baseDir}{$class}{$extension}#{$field}">
					<xsl:value-of select="$text"/>
				</a>
			</code>
		</xsl:when>
		<xsl:when test="$class and not($field)">
			<code>
				<a href="{$baseDir}{$class}{$extension}">
					<xsl:value-of select="$text"/>
				</a>
			</code>
		</xsl:when>
		<xsl:when test="not($class) and $field">
			<code>
				<a href="#{$field}">
					<xsl:value-of select="$text"/>
				</a>
			</code>
		</xsl:when>
		<xsl:otherwise>
			<code>
				<a href="#{$text}">
					<xsl:value-of select="$text"/>
				</a>
			</code>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>


<!-- create inheritance tree


<ul>
	<li><a href="">ParentClass</a>
		<ul>
			<li><a href="">ParentClass</a></li>
		</ul>
	</li>
</ul>


-->

<xsl:template name="outputClassTree">

	<xsl:variable name="current" select="$classTree//descendant::class[attribute::name = $className]"/>
	<xsl:variable name="parent" select="$current/parent::class[attribute::name]"/>

	<xsl:call-template name="outputParentClassTree">
		<xsl:with-param name="current" select="$parent"/>
		<xsl:with-param name="rest">
			<li><code><xsl:value-of select="$current/@name"/></code>
				<xsl:call-template name="derivedClasses">
					<xsl:with-param name="current" select="$current"/>
				</xsl:call-template>
			</li>
		</xsl:with-param>
	</xsl:call-template>

	<!--
	<xsl:value-of select="$classTree//descendant::class[attribute::name = $className]/parent::class/@name"/>
	-->

</xsl:template>


<xsl:template name="outputParentClassTree">
	<xsl:param name="current"/>
	<xsl:param name="rest"/>
	<xsl:variable name="parent" select="$current/parent::class[attribute::name]"/>

	<xsl:choose>
		<xsl:when test="$parent">
			<xsl:call-template name="outputParentClassTree">
				<xsl:with-param name="current" select="$parent"/>
				<xsl:with-param name="rest">
					<li>
						<xsl:call-template name="linkTemplate">
							<xsl:with-param name="class" select="$current/@name"/>
							<xsl:with-param name="text" select="$current/@name"/>
						</xsl:call-template>
						<ul>
							<xsl:copy-of select="$rest"/>
						</ul>
					</li>
				</xsl:with-param>
			</xsl:call-template>
		</xsl:when>
		<xsl:otherwise>
			<ul class="partial-class-tree">
				<xsl:choose>
					<xsl:when test="$current">
						<li>
							<xsl:call-template name="linkTemplate">
								<xsl:with-param name="class" select="$current/@name"/>
								<xsl:with-param name="text" select="$current/@name"/>
							</xsl:call-template>
							<ul>
								<xsl:copy-of select="$rest"/>
							</ul>
						</li>
					</xsl:when>
					<xsl:otherwise>
						<xsl:copy-of select="$rest"/>
					</xsl:otherwise>
				</xsl:choose>
			</ul>
		</xsl:otherwise>
	</xsl:choose>

</xsl:template>

<!--

	input:  <class name="...">....</class>
	output:	<ul><li>...</li><li>...</li>...</ul>

-->


<xsl:template name="derivedClasses">
	<xsl:param name="current"/>

	<xsl:variable name="show" select="count($current/class) &lt; 5"/>

	<ul id="api-derived-classes">
		<xsl:if test="not($show)">
			<li><code>
				<xsl:call-template name="linkTemplate">
					<xsl:with-param name="href">javascript:showDerivedClasses()</xsl:with-param>
					<xsl:with-param name="text">Show derived classes</xsl:with-param>
				</xsl:call-template>
			</code></li>
		</xsl:if>
		<xsl:for-each select="$current/class">
			<xsl:sort select="@name"/>
			<li>
				<xsl:if test="not($show)">
					<xsl:attribute name="style">display:none</xsl:attribute>
				</xsl:if>
				<xsl:call-template name="linkTemplate">
					<xsl:with-param name="class" select="@name"/>
					<xsl:with-param name="text" select="@name"/>
				</xsl:call-template>
			</li>
		</xsl:for-each>
	</ul>



</xsl:template>

<!-- map HTML elements -->

<xsl:template match="br | code | sub | sup">
	<xsl:copy>
		<xsl:apply-templates select="* | @* | text()"/>
	</xsl:copy>
</xsl:template>






</xsl:stylesheet>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -