2010-02-24 22:49:10 +08:00
|
|
|
<?xml version='1.0'?>
|
|
|
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
|
|
|
xmlns:exsl="http://exslt.org/common"
|
|
|
|
|
xmlns:ng="http://docbook.org/docbook-ng"
|
|
|
|
|
xmlns:db="http://docbook.org/ns/docbook"
|
|
|
|
|
exclude-result-prefixes="exsl"
|
|
|
|
|
version='1.0'>
|
|
|
|
|
|
|
|
|
|
<xsl:output method="text"
|
|
|
|
|
encoding="UTF-8"
|
|
|
|
|
indent="no"/>
|
|
|
|
|
<xsl:strip-space elements="arg"/>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="/">
|
|
|
|
|
<!-- Pull out cmdsynopsis to show the command usage line. -->Usage:
|
|
|
|
|
<xsl:value-of select="refentry/refsynopsisdiv/cmdsynopsis/command"/>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
<xsl:for-each select="refentry/refsynopsisdiv/cmdsynopsis/arg">
|
|
|
|
|
<xsl:if test="@choice='opt'">[</xsl:if>
|
|
|
|
|
<xsl:apply-templates select="." />
|
|
|
|
|
<xsl:if test="@choice='opt'">]</xsl:if>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
|
|
|
|
|
<!-- List options (any variable list in a section called "Options"). -->
|
|
|
|
|
<xsl:for-each select=".//*[title='Options']/variablelist">
|
2010-02-25 21:49:02 +08:00
|
|
|
<xsl:if test="position() = 1"> Options: </xsl:if>
|
2010-02-24 22:49:10 +08:00
|
|
|
<xsl:for-each select="varlistentry">
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
<xsl:for-each select=".//term">
|
|
|
|
|
<xsl:value-of select="."/>
|
|
|
|
|
<xsl:if test="not(position() = last())">, </xsl:if>
|
|
|
|
|
</xsl:for-each><xsl:text> </xsl:text>
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
|
|
|
|
|
<!-- List commands (any first-level variable list in a section called "Commands"). -->
|
2010-02-25 21:49:02 +08:00
|
|
|
<xsl:for-each select=".//*[title='Commands']/variablelist | .//*[title='Commands']/refsect2/variablelist">
|
|
|
|
|
<xsl:if test="position() = 1"> Commands: </xsl:if>
|
2010-02-24 22:49:10 +08:00
|
|
|
<xsl:for-each select="varlistentry">
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
<xsl:apply-templates select="term"/>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
|
|
|
|
|
<!-- Any paragraphs which have been marked as role="usage" (principally for global flags). -->
|
|
|
|
|
<xsl:for-each select="//para[@role='usage']">
|
|
|
|
|
<xsl:value-of select="normalize-space(.)"/><xsl:text> </xsl:text>
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
|
|
|
|
|
<!-- Any second-level variable lists (principally for options for subcommands). -->
|
|
|
|
|
<xsl:for-each select=".//*[title='Commands']//variablelist//variablelist">
|
|
|
|
|
<xsl:for-each select="varlistentry"><<xsl:apply-templates select="term"/>> - <xsl:apply-templates select="listitem"/>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
<xsl:text> </xsl:text>
|
|
|
|
|
</xsl:for-each>
|
|
|
|
|
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
|
|
<xsl:template match="replaceable"><<xsl:value-of select="normalize-space(.)"/>></xsl:template>
|
|
|
|
|
|
|
|
|
|
</xsl:stylesheet>
|