--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRtext.xsl Fri May 06 14:55:38 2011 -0400
@@ -0,0 +1,787 @@
+<?xml version="1.0"?>
+<!--
+ Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+ CDDL HEADER START
+
+ The contents of this file are subject to the terms of the
+ Common Development and Distribution License (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+-->
+
+<xsl:stylesheet version="1.0" xmlns:adr="http://www.opensolaris.org/ns/adr"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <!-- Write the opening elements -->
+ <xsl:output method="text" version="1.0" encoding="UTF-8"
+ indent="no" omit-xml-declaration="yes" standalone="yes"/>
+
+ <!-- Locale-specific content -->
+ <xsl:variable name="lang.title">INTERFACE DOCUMENTATION</xsl:variable>
+ <xsl:variable name="lang.enumTitle">Enumerated Types</xsl:variable>
+ <xsl:variable name="lang.structTitle">Structure Types</xsl:variable>
+ <xsl:variable name="lang.apiTitle">APIs</xsl:variable>
+ <xsl:variable name="lang.intfHead">Interface </xsl:variable>
+ <xsl:variable name="lang.enumLabel">enum </xsl:variable>
+ <xsl:variable name="lang.fbLabel">fallback </xsl:variable>
+ <xsl:variable name="lang.structLabel">struct </xsl:variable>
+ <xsl:variable name="lang.apiHead">Api </xsl:variable>
+ <xsl:variable name="lang.propHead">Properties</xsl:variable>
+ <xsl:variable name="lang.methHead">Methods</xsl:variable>
+ <xsl:variable name="lang.evHead">Events</xsl:variable>
+ <xsl:variable name="lang.verLabel">Version - </xsl:variable>
+ <xsl:variable name="lang.incApiHead">From Included </xsl:variable>
+ <xsl:variable name="lang.propLabel">Property: </xsl:variable>
+ <xsl:variable name="lang.typeLabel">Type: </xsl:variable>
+ <xsl:variable name="lang.roLabel">Read </xsl:variable>
+ <xsl:variable name="lang.woLabel">Write </xsl:variable>
+ <xsl:variable name="lang.rwLabel">Read-Write </xsl:variable>
+ <xsl:variable name="lang.roProp">Read-Only</xsl:variable>
+ <xsl:variable name="lang.woProp">Write-Only</xsl:variable>
+ <xsl:variable name="lang.rwProp">Read-Write</xsl:variable>
+ <xsl:variable name="lang.errLabel">Error:</xsl:variable>
+ <xsl:variable name="lang.methLabel">Method: </xsl:variable>
+ <xsl:variable name="lang.argLabel">Arguments:</xsl:variable>
+ <xsl:variable name="lang.resLabel">Result:</xsl:variable>
+ <xsl:variable name="lang.evLabel">Event: </xsl:variable>
+ <xsl:variable name="lang.voidLabel">void</xsl:variable>
+ <xsl:variable name="lang.optLabel">Optional</xsl:variable>
+
+ <xsl:variable name="indentstr" select="' '"/>
+
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="text()"/>
+
+ <xsl:template match="/">
+ <xsl:value-of select="$lang.title"/>
+ <xsl:call-template name="tunderline">
+ <xsl:with-param name="title" select="$lang.title"/>
+ </xsl:call-template>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <!-- Process the interface element -->
+ <xsl:template match="adr:interface">
+ <!-- Write out a heading -->
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 2 -->
+ <xsl:value-of select="$lang.intfHead"/>
+ <xsl:value-of select="@name"/>
+ <xsl:apply-templates select="adr:summary"/>
+ <xsl:apply-templates select="adr:doc">
+ <xsl:with-param name="indent" select="4"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[1][self::adr:summary|self::adr:doc])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+
+ <!-- Process the enum elements, if any -->
+ <xsl:if test="adr:enum">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="$lang.enumTitle"/>
+ <xsl:call-template name="tunderline">
+ <xsl:with-param name="title" select="$lang.enumTitle"/>
+ <xsl:with-param name="indent" select="4"/>
+ </xsl:call-template>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="adr:enum"/>
+ </xsl:if>
+
+ <!-- Process the type elements, if any -->
+ <xsl:if test="adr:type">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="$lang.structTitle"/>
+ <xsl:call-template name="tunderline">
+ <xsl:with-param name="title" select="$lang.structTitle"/>
+ <xsl:with-param name="indent" select="4"/>
+ </xsl:call-template>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="adr:type"/>
+ </xsl:if>
+
+ <!-- Process the api elements, if any -->
+ <xsl:if test="adr:api">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="$lang.apiTitle"/>
+ <xsl:call-template name="tunderline">
+ <xsl:with-param name="title" select="$lang.apiTitle"/>
+ <xsl:with-param name="indent" select="4"/>
+ </xsl:call-template>
+ <xsl:apply-templates select="adr:api"/>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Process the enum, enum value, enum fallback elements -->
+ <xsl:template match="adr:interface/adr:enum">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="$lang.enumLabel"/>
+ <xsl:value-of select="@name"/>
+ <xsl:apply-templates select="adr:summary"/>
+ <xsl:apply-templates select="adr:doc">
+ <xsl:with-param name="indent" select="4"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[1][self::adr:summary|self::adr:doc])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ <xsl:text>
</xsl:text>
+ <xsl:call-template name="tenum"/>
+ <xsl:apply-templates select="adr:fallback"/>
+ </xsl:template>
+
+ <!-- Process all the enum value elements -->
+ <xsl:template name="tenum">
+ <xsl:param name="thenode" select="adr:value[1]"/>
+ <xsl:param name="initval" select="0"/>
+ <xsl:variable name="currvalue">
+ <xsl:choose>
+ <xsl:when test="$thenode/@value">
+ <xsl:value-of select="$thenode/@value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$initval"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:text> </xsl:text> <!-- indent = 6 -->
+ <xsl:value-of select="$thenode/@name"/>
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="$currvalue"/>
+ <xsl:text>)</xsl:text>
+ <xsl:apply-templates select="$thenode/adr:summary"/>
+ <xsl:apply-templates select="$thenode/adr:doc">
+ <xsl:with-param name="indent" select="8"/>
+ </xsl:apply-templates>
+ <xsl:if test="not($thenode/adr:summary)">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+
+ <xsl:if test="$thenode/following-sibling::adr:value[1]">
+ <xsl:call-template name="tenum">
+ <xsl:with-param name="thenode"
+ select="$thenode/following-sibling::adr:value[1]"/>
+ <xsl:with-param name="initval" select="$currvalue + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Process the enum fallback elements -->
+ <xsl:template match="adr:enum/adr:fallback">
+ <xsl:text> </xsl:text> <!-- indent = 6 -->
+ <xsl:value-of select="$lang.fbLabel"/>
+ <xsl:text>(</xsl:text>
+ <xsl:value-of select="@name"/>
+ <xsl:text>)</xsl:text>
+ <xsl:apply-templates select="adr:summary"/>
+ <xsl:apply-templates select="adr:doc">
+ <xsl:with-param name="indent" select="8"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[1][self::adr:summary])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Process the type (struct), type field, include elements -->
+ <xsl:template match="adr:interface/adr:type">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="$lang.structLabel"/>
+ <xsl:value-of select="@name"/>
+ <xsl:apply-templates select="adr:summary"/>
+ <xsl:apply-templates select="adr:doc">
+ <xsl:with-param name="indent" select="4"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[1][self::adr:summary|self::adr:doc])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="adr:include"/>
+ <xsl:apply-templates select="adr:field"/>
+ </xsl:template>
+
+ <!-- Process the include elements within a type definition -->
+ <xsl:template match="adr:type/adr:include">
+ <xsl:apply-templates select="//adr:type[@name = current()/@typeref]"
+ mode="include"/>
+ </xsl:template>
+
+ <!-- Process the type field elements -->
+ <xsl:template match="adr:type/adr:field">
+ <xsl:text> </xsl:text> <!-- indent = 6 -->
+ <xsl:value-of select="@name"/>
+ <xsl:text> (</xsl:text>
+ <xsl:call-template name="ttype"/>
+ <xsl:call-template name="topt"/>
+ <xsl:text>)</xsl:text>
+ <xsl:apply-templates select="adr:summary"/>
+ <xsl:apply-templates select="adr:doc">
+ <xsl:with-param name="indent" select="8"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[1][self::adr:summary])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Process included type elements -->
+ <xsl:template match="adr:type" mode="include">
+ <xsl:apply-templates select="adr:field"/>
+ </xsl:template>
+
+ <!-- Process the api, api property, api method, api event elements -->
+ <xsl:template match="adr:interface/adr:api">
+ <xsl:text>
</xsl:text>
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="$lang.apiHead"/>
+ <xsl:value-of select="@name"/>
+ <xsl:apply-templates select="adr:summary"/>
+ <xsl:apply-templates select="adr:doc">
+ <xsl:with-param name="indent" select="6"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[1][self::adr:summary|self::adr:doc])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+
+ <!-- Process the version elements, if any -->
+ <xsl:apply-templates select="adr:version[position() = 1]"/>
+
+ <!-- Save the "included" api, if any -->
+ <xsl:variable name="incApi"
+ select="//adr:api[@name = current()/adr:include/@typeref]"/>
+
+ <!-- Write a properties header, if needed -->
+ <xsl:if test="adr:property | $incApi/adr:property">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="$lang.propHead"/>
+ <xsl:call-template name="tunderline">
+ <xsl:with-param name="title" select="$lang.propHead"/>
+ <xsl:with-param name="indent" select="4"/>
+ </xsl:call-template>
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+
+ <!-- Process the api properties, if any -->
+ <xsl:if test="adr:property">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="@name"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$lang.propHead"/>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="adr:property"/>
+ </xsl:if>
+
+ <!-- Process the included api properties, if any -->
+ <xsl:if test="$incApi/adr:property">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="@name"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$lang.propHead"/>
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="$lang.incApiHead"/>
+ <xsl:value-of select="$lang.apiHead"/>
+ <xsl:value-of select="current()/adr:include/@typeref"/>
+ <xsl:text>)</xsl:text>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="$incApi/adr:property"/>
+ </xsl:if>
+
+ <!-- Write a methods header, if needed -->
+ <xsl:if test="adr:method | $incApi/adr:method">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="$lang.methHead"/>
+ <xsl:call-template name="tunderline">
+ <xsl:with-param name="title" select="$lang.methHead"/>
+ <xsl:with-param name="indent" select="4"/>
+ </xsl:call-template>
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+
+ <!-- Process the api methods, if any -->
+ <xsl:if test="adr:method">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="@name"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$lang.methHead"/>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="adr:method"/>
+ </xsl:if>
+
+ <!-- Process the included api methods, if any -->
+ <xsl:if test="$incApi/adr:method">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="@name"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$lang.methHead"/>
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="$lang.incApiHead"/>
+ <xsl:value-of select="$lang.apiHead"/>
+ <xsl:value-of select="current()/adr:include/@typeref"/>
+ <xsl:text>)</xsl:text>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="$incApi/adr:method"/>
+ </xsl:if>
+
+ <!-- Write an events header, if needed -->
+ <xsl:if test="adr:event | $incApi/adr:event">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="$lang.evHead"/>
+ <xsl:call-template name="tunderline">
+ <xsl:with-param name="title" select="$lang.evHead"/>
+ <xsl:with-param name="indent" select="4"/>
+ </xsl:call-template>
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+
+ <!-- Process the api events, if any -->
+ <xsl:if test="adr:event">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="@name"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$lang.evHead"/>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="adr:event"/>
+ </xsl:if>
+
+ <!-- Process the included api events, if any -->
+ <xsl:if test="$incApi/adr:event">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 4 -->
+ <xsl:value-of select="@name"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$lang.evHead"/>
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="$lang.incApiHead"/>
+ <xsl:value-of select="$lang.apiHead"/>
+ <xsl:value-of select="current()/adr:include/@typeref"/>
+ <xsl:text>)</xsl:text>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="$incApi/adr:event"/>
+ </xsl:if>
+
+ </xsl:template> <!-- end api property, api method, api event elements -->
+
+ <!-- Process api version elements -->
+ <xsl:template match="adr:api/adr:version">
+ <xsl:text> </xsl:text> <!-- indent = 6 -->
+ <xsl:value-of select="$lang.verLabel"/>
+ <xsl:for-each select="parent::node()/adr:version">
+ <xsl:value-of select="@stability"/>
+ <xsl:text>(</xsl:text>
+ <xsl:value-of select="@major"/>
+ <xsl:text>.</xsl:text>
+ <xsl:value-of select="@minor"/>
+ <xsl:text>)</xsl:text>
+ <xsl:if test="position() != last()">, </xsl:if>
+ </xsl:for-each>
+ <xsl:text>
</xsl:text>
+ </xsl:template>
+
+ <!-- Process the property, property error elements -->
+ <xsl:template match="adr:property">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 6 -->
+ <xsl:value-of select="$lang.propLabel"/>
+ <xsl:value-of select="@name"/>
+ <xsl:text> (</xsl:text>
+ <xsl:call-template name="ttype"/>
+ <xsl:text>, </xsl:text>
+ <xsl:call-template name="taccess"/>
+ <xsl:call-template name="topt"/>
+ <xsl:text>)</xsl:text>
+ <xsl:apply-templates select="adr:summary"/>
+ <xsl:apply-templates select="adr:doc">
+ <xsl:with-param name="indent" select="6"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[1][self::adr:summary|self::adr:doc])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ <xsl:apply-templates select="adr:error"/>
+ </xsl:template>
+
+ <!-- Process the property error elements -->
+ <xsl:template match="adr:property/adr:error">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 8 -->
+ <xsl:choose>
+ <xsl:when test="@for='ro' or parent::node()/@access='ro'">
+ <xsl:value-of select="$lang.roLabel"/>
+ </xsl:when>
+ <xsl:when test="@for='wo' or parent::node()/@access='wo'">
+ <xsl:value-of select="$lang.woLabel"/>
+ </xsl:when>
+ <xsl:when test="@for='rw' or parent::node()/@access='rw'">
+ <xsl:value-of select="$lang.rwLabel"/>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:value-of select="$lang.errLabel"/>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="ttype"/>
+ <xsl:apply-templates select="adr:summary"/>
+ <xsl:apply-templates select="adr:doc">
+ <xsl:with-param name="indent" select="10"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[1][self::adr:summary|self::adr:doc])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Process the method, argument, result, method error elements -->
+ <xsl:template match="adr:api/adr:method">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 6 -->
+ <xsl:value-of select="$lang.methLabel"/>
+ <xsl:value-of select="@name"/>
+ <xsl:text>(</xsl:text>
+ <xsl:for-each select="adr:argument">
+ <xsl:value-of select="@name"/>
+ <xsl:if test="position() != last()">, </xsl:if>
+ </xsl:for-each>
+ <xsl:text>)</xsl:text>
+ <xsl:apply-templates select="adr:summary"/>
+ <xsl:apply-templates select="adr:doc">
+ <xsl:with-param name="indent" select="6"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[1][self::adr:summary|self::adr:doc])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ <xsl:if test="count(adr:argument) > 0">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 8 -->
+ <xsl:value-of select="$lang.argLabel"/>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="adr:argument"/>
+ </xsl:if>
+ <xsl:if test="count(adr:result) > 0">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 8 -->
+ <xsl:value-of select="$lang.resLabel"/>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="adr:result"/>
+ </xsl:if>
+ <xsl:if test="count(adr:error) > 0">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 8 -->
+ <xsl:value-of select="$lang.errLabel"/>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="adr:error"/>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Process the method argument elements -->
+ <xsl:template match="adr:method/adr:argument">
+ <xsl:text> </xsl:text> <!-- indent = 8 -->
+ <xsl:value-of select="@name"/>
+ <xsl:text> (</xsl:text>
+ <xsl:call-template name="ttype"/>
+ <xsl:call-template name="topt"/>
+ <xsl:text>)</xsl:text>
+ <xsl:apply-templates select="adr:summary"/>
+ <xsl:apply-templates select="adr:doc">
+ <xsl:with-param name="indent" select="10"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[1][self::adr:summary|self::adr:doc])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Process the method result elements -->
+ <xsl:template match="adr:method/adr:result">
+ <xsl:text> </xsl:text> <!-- indent = 8 -->
+ <xsl:call-template name="ttype"/>
+ <xsl:if test="@optional='true' or @optional='1'">
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="$lang.optLabel"/>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ <xsl:apply-templates select="adr:summary"/>
+ <xsl:apply-templates select="adr:doc">
+ <xsl:with-param name="indent" select="10"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[1][self::adr:summary|self::adr:doc])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Process the method error elements -->
+ <xsl:template match="adr:method/adr:error">
+ <xsl:text> </xsl:text> <!-- indent = 8 -->
+ <xsl:call-template name="ttype"/>
+ <xsl:apply-templates select="adr:summary"/>
+ <xsl:apply-templates select="adr:doc">
+ <xsl:with-param name="indent" select="10"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[1][self::adr:summary|self::adr:doc])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Process the event elements -->
+ <xsl:template match="adr:api/adr:event">
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 6 -->
+ <xsl:value-of select="$lang.evLabel"/>
+ <xsl:value-of select="@name"/>
+ <xsl:apply-templates select="adr:summary"/>
+ <xsl:apply-templates select="adr:doc">
+ <xsl:with-param name="indent" select="8"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[1][self::adr:summary|self::adr:doc])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ <xsl:text>
</xsl:text>
+ <xsl:text> </xsl:text> <!-- indent = 8 -->
+ <xsl:value-of select="$lang.typeLabel"/>
+ <xsl:call-template name="ttype"/>
+ <xsl:text>
</xsl:text>
+ </xsl:template>
+
+ <!-- Named Templates -->
+ <!-- Process type definition for structs fields, props, methods, events -->
+ <xsl:template name="ttype">
+ <xsl:choose>
+ <xsl:when test="@type">
+ <xsl:value-of select="@type"/>
+ </xsl:when>
+ <xsl:when test="@typeref">
+ <xsl:apply-templates
+ select="(//adr:type|//adr:enum)[@name = current()/@typeref]"
+ mode="refclass"/>
+ <xsl:value-of select="@typeref"/>
+ </xsl:when>
+ <xsl:when test="adr:list/@type">
+ <xsl:value-of select="adr:list/@type"/><xsl:text>[]</xsl:text>
+ </xsl:when>
+ <xsl:when test="adr:list/@typeref">
+ <xsl:apply-templates select="
+ (//adr:type|//adr:enum)[@name = current()/adr:list/@typeref]"
+ mode="refclass"/>
+ <xsl:value-of select="adr:list/@typeref"/>
+ <xsl:text>[]</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$lang.voidLabel"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Process optional attribute for struct fields, methods -->
+ <xsl:template name="topt">
+ <xsl:if test="@optional='true' or @optional='1'">
+ <xsl:text>, </xsl:text>
+ <xsl:value-of select="$lang.optLabel"/>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Process access attribute for properties -->
+ <xsl:template name="taccess">
+ <xsl:choose>
+ <xsl:when test="@access='ro'">
+ <xsl:value-of select="$lang.roProp"/>
+ </xsl:when>
+ <xsl:when test="@access='wo'">
+ <xsl:value-of select="$lang.woProp"/>
+ </xsl:when>
+ <xsl:otherwise> <!-- access=rw -->
+ <xsl:value-of select="$lang.rwProp"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Output formatting -->
+ <xsl:template name="tunderline">
+ <xsl:param name="title" select="''"/>
+ <xsl:param name="indent" select="0"/>
+ <xsl:param name="len" select="string-length($title)"/>
+ <xsl:if test="string-length($title) > 0">
+ <xsl:text>
</xsl:text>
+ <xsl:value-of select="substring($indentstr, 1, $indent)"/>
+ </xsl:if>
+ <xsl:if test="$len > 0">
+ <xsl:text>-</xsl:text>
+ <xsl:call-template name="tunderline">
+ <xsl:with-param name="len" select="$len - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Templates for type specification -->
+ <xsl:template match="adr:enum" mode="refclass">
+ <xsl:value-of select="$lang.enumLabel"/>
+ </xsl:template>
+
+ <xsl:template match="adr:type" mode="refclass">
+ <xsl:value-of select="$lang.structLabel"/>
+ </xsl:template>
+
+ <!-- Process the documentation elements - adr:summary, adr:doc -->
+ <!-- Process the documentation summary elements -->
+ <xsl:template match="adr:summary">
+ <xsl:text> -- </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>
</xsl:text>
+ </xsl:template>
+
+ <!-- Process the summary text nodes -->
+ <xsl:template match="adr:summary//text()">
+ <xsl:value-of select="normalize-space(.)"/>
+ </xsl:template>
+
+ <!-- Process the (inline) code doc elements -->
+ <xsl:template match="adr:summary//adr:code|adr:doc//adr:code">
+ <xsl:if test="preceding-sibling::node()">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:apply-templates/>
+ <xsl:if test="following-sibling::node()">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Process the (inline) strong doc elements -->
+ <xsl:template match="adr:summary//adr:strong|adr:doc//adr:strong">
+ <xsl:if test="preceding-sibling::node()">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:apply-templates/>
+ <xsl:if test="following-sibling::node()">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Process the (inline) link doc elements -->
+ <xsl:template match="adr:summary//adr:link|adr:doc//adr:link">
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="@url"/>
+ <xsl:text>) </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text> </xsl:text>
+ </xsl:template>
+
+ <!-- Process the (inline) br doc elements -->
+ <xsl:template match="adr:summary//adr:br|adr:doc//adr:br">
+ <xsl:text>
</xsl:text>
+ </xsl:template>
+
+ <!-- Process the detail documentation (doc) elements -->
+ <xsl:template match="adr:doc">
+ <xsl:param name="indent" select="0"/>
+ <xsl:if test="not(child::*[1][self::adr:para])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ <xsl:apply-templates select="text()[normalize-space(.) != '']|*">
+ <xsl:with-param name="indent" select="$indent"/>
+ </xsl:apply-templates>
+ <xsl:if test="not(child::*[last()][self::adr:para])">
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Process the doc text nodes -->
+ <xsl:template match="adr:doc//text()">
+ <xsl:param name="indent" select="0"/>
+ <xsl:if test="$indent > 0">
+ <!-- If a text node is the first element or if a text node occurs right
+ after a br element, indent the text on output -->
+ <xsl:if test=
+ "(not(preceding-sibling::*))or preceding-sibling::*[1][self::adr:br]">
+ <xsl:value-of select="substring($indentstr, 1, $indent)"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:value-of select="normalize-space(.)"/>
+ </xsl:template>
+
+ <!-- Process the (block) heading doc elements -->
+ <xsl:template match="adr:doc//adr:heading">
+ <xsl:param name="indent" select="0"/>
+ <xsl:text>
</xsl:text>
+ <xsl:if test="$indent > 0">
+ <xsl:value-of select="substring($indentstr, 1, $indent)"/>
+ </xsl:if>
+ <xsl:variable name="heading">
+ <xsl:value-of select="normalize-space(.)"/>
+ </xsl:variable>
+ <xsl:value-of select="$heading"/>
+ <xsl:call-template name="tunderline">
+ <xsl:with-param name="indent" select="$indent"/>
+ <xsl:with-param name="title" select="$heading"/>
+ </xsl:call-template>
+ <xsl:text>
</xsl:text>
+ </xsl:template>
+
+ <!-- Process the (block) para doc elements -->
+ <xsl:template match="adr:doc//adr:para">
+ <xsl:param name="indent" select="0"/>
+ <xsl:text>
</xsl:text>
+ <xsl:apply-templates select="text()[normalize-space(.)]|*">
+ <xsl:with-param name="indent" select="$indent"/>
+ </xsl:apply-templates>
+ <xsl:text>
</xsl:text>
+ </xsl:template>
+
+ <!-- Process the (block) list doc elements -->
+ <xsl:template match="adr:doc//adr:list">
+ <xsl:param name="indent" select="0"/>
+ <xsl:apply-templates select="adr:item">
+ <xsl:with-param name="indent" select="$indent + 2"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <!-- Process the (block) list item doc elements -->
+ <xsl:template match="adr:list/adr:item">
+ <xsl:param name="indent" select="0"/>
+ <xsl:if test="$indent > 0">
+ <xsl:text>
</xsl:text>
+ <xsl:value-of select="substring($indentstr, 1, $indent)"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="parent::node()[@type ='ordered']">
+ <xsl:number/><xsl:text>. </xsl:text>
+ <xsl:apply-templates select="text()[normalize-space(.)]|*"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>* </xsl:text>
+ <xsl:apply-templates select="text()[normalize-space(.)]|*"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Process the (block) example doc elements -->
+ <xsl:template match="adr:doc//adr:example">
+ <xsl:param name="indent" select="0"/>
+ <xsl:text>
</xsl:text>
+ <xsl:if test="$indent > 0">
+ <xsl:value-of select="substring($indentstr, 1, $indent)"/>
+ </xsl:if>
+ <xsl:value-of select="@caption"/>
+ <xsl:text>
</xsl:text>
+ <xsl:value-of select="self::node()"/>
+ </xsl:template>
+
+</xsl:stylesheet>