<!-- ==================================================================== -->
<xsl:template match="/">
- <xsl:choose>
- <xsl:when test="//refentry">
- <!-- * Check to see if we have any refentry children in this -->
- <!-- * document; if so, process them. -->
- <xsl:apply-templates select="//refentry"/>
- <!-- * if $man.output.manifest.enabled is non-zero, -->
- <!-- * generate a manifest file -->
- <xsl:if test="not($man.output.manifest.enabled = 0)">
- <xsl:call-template name="generate.manifest">
- <xsl:with-param name="filename">
- <xsl:choose>
- <xsl:when test="not($man.output.manifest.filename = '')">
- <!-- * If a name for the manifest file is specified, -->
- <!-- * use that name. -->
- <xsl:value-of select="$man.output.manifest.filename"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- * Otherwise, if user has unset -->
- <!-- * $man.output.manifest.filename, default to -->
- <!-- * using "MAN.MANIFEST" as the filename. Because -->
- <!-- * $man.output.manifest.enabled is non-zero and -->
- <!-- * so we must have a filename in order to -->
- <!-- * generate the manifest. -->
- <xsl:text>MAN.MANIFEST</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <!-- * Otherwise, the document does not contain any -->
- <!-- * refentry elements, so emit message and stop. -->
- <xsl:variable name="title">
- <!-- * Get a title so that we let the user know what -->
- <!-- * document we are processing at this point. -->
+ <xsl:variable name="title">
+ <!-- * Get a title so that we let the user know what -->
+ <!-- * document we are processing at this point. -->
+ <xsl:choose>
+ <xsl:when test="//*[local-name() = 'title'
+ or local-name() = 'refname']">
+ <xsl:value-of select="//*[local-name() = 'title'
+ or local-name() = 'refname'][1]"/>
+ </xsl:when>
+ <xsl:when test="substring(local-name(*[1]),
+ string-length(local-name(*[1])-3) = 'info')
+ and *[1]/*[local-name() = 'title']">
+ <xsl:value-of select="*[1]/*[local-name() = 'title'][1]"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="(//self::ng:* or //self::db:*) and $DistroName = 'docbook-xsl'">
+ <xsl:call-template name="log.message">
+ <xsl:with-param name="level">Erro</xsl:with-param>
+ <xsl:with-param name="source" select="$title"/>
+ <xsl:with-param name="context-desc">
+ <xsl:text> namespace</xsl:text>
+ </xsl:with-param>
+ <xsl:with-param name="message">
+ <xsl:text>Can't process namespaced DocBook document.</xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:message>
+ <xsl:text> To create man-page output from a namespaced DocBook document</xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> (DocBook 5 or later), you must either use the docbook5-xsl</xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> stylesheets:</xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> http://docbook.sf.net/files/docbook5-xsl/latest</xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> Or you must first pre-process your document with the</xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> stripns.xsl stylesheet to strip the namespace. You can strip</xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> the namespace and convert the document to man-page output in</xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> one pass using a pipe; for example:</xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> xsltproc \</xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> http://docbook.sf.net/release/xsl/current/common/stripns.xsl \</xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$title"/>
+ <xsl:text>.xml \</xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> | xsltproc \</xsl:text>
+ <xsl:text> </xsl:text>
+ <xsl:text> http://docbook.sf.net/release/xsl/current/manpages/docbook.xsl -</xsl:text>
+ </xsl:message>
+ </xsl:when>
+ <xsl:when test="//refentry">
+ <!-- * Check to see if we have any refentry children in this -->
+ <!-- * document; if so, process them. -->
+ <xsl:apply-templates select="//refentry"/>
+ <!-- * if $man.output.manifest.enabled is non-zero, -->
+ <!-- * generate a manifest file -->
+ <xsl:if test="not($man.output.manifest.enabled = 0)">
+ <xsl:call-template name="generate.manifest">
+ <xsl:with-param name="filename">
<xsl:choose>
- <xsl:when test="title">
- <xsl:value-of select="title[1]"/>
+ <xsl:when test="not($man.output.manifest.filename = '')">
+ <!-- * If a name for the manifest file is specified, -->
+ <!-- * use that name. -->
+ <xsl:value-of select="$man.output.manifest.filename"/>
</xsl:when>
- <xsl:when test="substring(local-name(*[1]),
- string-length(local-name(*[1])-3) = 'info')
- and *[1]/title">
- <xsl:value-of select="*[1]/title[1]"/>
+ <xsl:otherwise>
+ <!-- * Otherwise, if user has unset -->
+ <!-- * $man.output.manifest.filename, default to -->
+ <!-- * using "MAN.MANIFEST" as the filename. Because -->
+ <!-- * $man.output.manifest.enabled is non-zero and -->
+ <!-- * so we must have a filename in order to -->
+ <!-- * generate the manifest. -->
+ <xsl:text>MAN.MANIFEST</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- * Otherwise, the document does not contain any -->
+ <!-- * refentry elements, so log/emit message and stop. -->
+ <xsl:call-template name="log.message">
+ <xsl:with-param name="level">Erro</xsl:with-param>
+ <xsl:with-param name="source" select="$title"/>
+ <xsl:with-param name="context-desc">
+ <xsl:text> no refentry</xsl:text>
+ </xsl:with-param>
+ <xsl:with-param name="message">
+ <xsl:text>No refentry elements found</xsl:text>
+ <xsl:if test="$title != ''">
+ <xsl:text> in "</xsl:text>
+ <xsl:choose>
+ <xsl:when test="string-length($title) > 30">
+ <xsl:value-of select="substring($title,1,30)"/>
+ <xsl:text>...</xsl:text>
</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$title"/>
+ </xsl:otherwise>
</xsl:choose>
- </xsl:variable>
- <xsl:message>
- <xsl:text>Note: No refentry elements found in "</xsl:text>
- <xsl:value-of select="local-name(.)"/>
- <xsl:if test="$title != ''">
- <xsl:choose>
- <xsl:when test="string-length($title) > 30">
- <xsl:value-of select="substring($title,1,30)"/>
- <xsl:text>...</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$title"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
<xsl:text>"</xsl:text>
- </xsl:message>
- </xsl:otherwise>
- </xsl:choose>
+ </xsl:if>
+ <xsl:text>.</xsl:text>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<!-- ============================================================== -->