7150175 radadrgen should generate rad module man pages
7150179 radadrgen should validate against original rng schema
7150184 radadrgen's output doesn't conform to docbook schema
7150189 adr schema should support documentation markup for union arms
7150226 radadrgen transforms should be internationalized
7150292 radadrgen -c should take a directory name, like -j
7150294 radadrgen command line usage should be broken into multiple synopses
7150352 radadrgen -o text should be revisited
7106700 radadrgen man page lacks documentation, -N, -m options
<?xml version="1.0"?>
<!--
Copyright (c) 2012, 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"
exclude-result-prefixes="adr">
<!-- Common docbook xsl templates -->
<xsl:import href="radadr-docbook-common.xsl"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="no" omit-xml-declaration="no" standalone="no"
doctype-public="-//OASIS//DTD DocBook V4.4//EN"
doctype-system="http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"/>
<!-- Manpage-specific content -->
<xsl:variable name="element.section1">refsect1</xsl:variable>
<xsl:variable name="element.section2">refsect2</xsl:variable>
<xsl:variable name="element.section3">refsect3</xsl:variable>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="adr:interface">
<xsl:variable name="basename">
<xsl:call-template name="basename">
<xsl:with-param name="str" select='@name'/>
</xsl:call-template>
</xsl:variable>
<xsl:element name="refentry">
<xsl:attribute name='id'>
<xsl:value-of select="concat('man.', $basename)"/>
</xsl:attribute>
<refentryinfo>
<productname>SunOS</productname>
<productnumber>5.11</productnumber>
</refentryinfo>
<refmeta>
<refentrytitle>
<xsl:value-of select="$basename"/>
</refentrytitle>
<manvolnum>3rad</manvolnum>
<refmiscinfo class="manual">
<xsl:call-template name="getString">
<xsl:with-param name="name" select="'docbook.man.refmiscinfo'"/>
</xsl:call-template>
</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<xsl:value-of select="$basename"/>
</refname>
<xsl:if test="adr:summary">
<refpurpose>
<xsl:apply-templates select="adr:summary" mode="inline">
<xsl:with-param name="usehyphen" select="0"/>
</xsl:apply-templates>
</refpurpose>
</xsl:if>
</refnamediv>
<refsynopsisdiv>
<xsl:apply-templates select="adr:api" mode="synopsis"/>
</refsynopsisdiv>
<refsect1 role="description">
<title>
<xsl:call-template name="getString">
<xsl:with-param name="name"
select="'docbook.man.section.description'"/>
</xsl:call-template>
</title>
<xsl:call-template name="header">
<xsl:with-param name="node">
<xsl:call-template name="getString">
<xsl:with-param name="name" select="'docbook.interface.label'"/>
<xsl:with-param name="params">
<param>
<xsl:value-of select="@name"/>
</param>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="adr:doc"/>
</refsect1>
<xsl:apply-templates select="." mode="children"/>
</xsl:element>
</xsl:template>
<xsl:template match="adr:api" mode="synopsis">
<refsect2>
<title>
<xsl:call-template name="getString">
<xsl:with-param name="name" select="'docbook.api.label'"/>
<xsl:with-param name="params">
<param>
<xsl:value-of select="@name"/>
</param>
</xsl:with-param>
</xsl:call-template>
</title>
<synopsis>
<xsl:apply-templates select="adr:property" mode="synopsis"/>
</synopsis>
<xsl:apply-templates select="adr:method" mode="synopsis"/>
</refsect2>
</xsl:template>
<xsl:template match="adr:property" mode="synopsis">
<fieldsynopsis>
<xsl:apply-templates select="." mode="type"/>
<varname>
<xsl:value-of select="@name"/>
</varname>
</fieldsynopsis>
</xsl:template>
<xsl:template match="adr:method" mode="synopsis">
<synopsis>
<methodsynopsis>
<xsl:apply-templates select="adr:result" mode="type"/>
<methodname>
<xsl:value-of select="@name"/>
</methodname>
<xsl:choose>
<xsl:when test="not(adr:argument)">
<void/>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="adr:argument">
<methodparam>
<xsl:apply-templates select="." mode="type"/>
<parameter>
<xsl:value-of select="@name"/>
</parameter>
</methodparam>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</methodsynopsis>
</synopsis>
</xsl:template>
<xsl:template name="basename">
<xsl:param name="str"/>
<xsl:param name="delim">.</xsl:param>
<xsl:choose>
<xsl:when test="contains($str, $delim)">
<xsl:call-template name="basename">
<xsl:with-param name="str" select="substring-after($str, $delim)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$str"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>