This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook-apps] xsl-stylesheets/manpages


Le Lundi 19 Mai 2003 19:10, Tim Waugh a écrit :

> It is better to use the http:// form.

OK, I note it

> Oh, I see.  Well, the placing of the AUTHORS section is hard-coded at
> the moment (as is its name, unfortunately).
>
> As for handling <othercredit>, please try the attached stylesheet.
> Use 'xmlto -x ./docbook.xsl ...'.

I tried it, but this isn't the rendering I want.
I want to add two "refsect1" (TRANSLATION and REVIEWER) after the refsect1 
AUTHORS.

The docbook-fr.xsl I'll try to create make it but don't put the good 
information in the refsect1: 
- the authors, copyright, name and pubdate are added in both section 
TRANSLATION and REVIEWER, and of course I don't want
- reviewer name, affiliation and contrib are added in the TRANSLATION section
- translator name, affiliation and contrib are added in the REVIEWER section

Could you tell me what's wrong in that stylesheet ?
I wish also adding the pubdate just after the email of the translator

Regards
-- 
Alain PORTAL
Service Commun de Microscopie Electronique
Case Courrier 087
Université de Montpellier II
Place Eugène Bataillon
34095 Montpellier Cedex 05

Tél. : 04 67 14 37 35
Fax. : 04 67 14 37 37
E-mail : aportal@univ-montp2.fr

http://www.univ-montp2.fr/~micro-elec-web/
<?xml version='1.0' encoding="ISO-8859-15"?>
<!-- vim:set sts=2 shiftwidth=2 syntax=sgml: -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:xt="http://www.jclark.com/xt";
                extension-element-prefixes="xt"
                version='1.0'>

<xsl:import href="docbook.xsl"/>

<xsl:include href="http://docbook.sourceforge.net/release/xsl/current/common/common.xsl"/>

<xsl:include href="synop.xsl"/>
<xsl:include href="lists.xsl"/>
<xsl:include href="xref.xsl"/>

<xsl:output method="text"
            encoding="ISO-8859-15"
            indent="no"/>

<xsl:template match="refsect1">
  <xsl:text>
.SH "</xsl:text>
  <xsl:value-of select="translate(title[1],'aàâbcdeéèêëfghiîïjklmnoôöpqrstuûüvwxyz', 'AÀÂBCDEÉÈÊËFGHIÎÏJKLMNOÔÖPQRSTUÛÜVWXYZ')"/>
  <xsl:text>"
</xsl:text>
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="refentry">
  <xsl:variable name="section" select="refmeta/manvolnum"/>
  <xsl:variable name="name" select="refmeta/refentrytitle"/>

  <xsl:call-template name="write-page">
    <xsl:with-param name="filename" select="concat($name, '.', $section)"/>
    <xsl:with-param name="contents">
      <xsl:text>.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "</xsl:text>
      <xsl:value-of select="translate(refmeta/refentrytitle,'aàâbcdeéèêëfghiîïjklmnoôöpqrstuûüvwxyz', 'AÀÂBCDEÉÈÊËFGHIÎÏJKLMNOÔÖPQRSTUÛÜVWXYZ')"/>
      <xsl:text>" </xsl:text>
      <xsl:value-of select="refmeta/manvolnum[1]"/>
      <xsl:text> "</xsl:text>
      <xsl:value-of select="refentryinfo/date"/>
      <xsl:text>" "</xsl:text>
      <xsl:value-of select="refentryinfo/productname"/>
      <xsl:text>" "</xsl:text>
      <xsl:value-of select="refentryinfo/title"/>
      <xsl:text>"
</xsl:text>
      <xsl:apply-templates/>
      <xsl:text>&#10;</xsl:text>

      <!-- Author section -->
      <xsl:choose>
        <xsl:when test="refentryinfo//author">
          <xsl:apply-templates select="refentryinfo" mode="authorsect"/>
        </xsl:when>
        <xsl:when test="/book/bookinfo//author">
          <xsl:apply-templates select="/book/bookinfo" mode="authorsect"/>
        </xsl:when>
        <xsl:when test="/article/articleinfo//author">
          <xsl:apply-templates select="/article/articleinfo" mode="authorsect"/>
        </xsl:when>
      </xsl:choose>

      <!-- Translation section -->
      <xsl:choose>
        <xsl:when test="refentryinfo//othercredit/@role='translation'">
          <xsl:apply-templates select="refentryinfo" mode="translationsect"/>
        </xsl:when>
        <xsl:when test="/book/bookinfo//othercredit/@role='translation'">
          <xsl:apply-templates select="/book/bookinfo" mode="translationsect"/>
        </xsl:when>
        <xsl:when test="/article/articleinfo//othercredit/@role='translation'">
          <xsl:apply-templates select="/article/articleinfo" mode="translationsect"/>
        </xsl:when>
      </xsl:choose>

      <!-- Reviewer section -->
      <xsl:choose>
        <xsl:when test="refentryinfo//othercredit/@role='reviewer'">
          <xsl:apply-templates select="refentryinfo" mode="reviewersect"/>
        </xsl:when>
        <xsl:when test="/book/bookinfo//othercredit/@role='reviewer'">
          <xsl:apply-templates select="/book/bookinfo" mode="reviewersect"/>
        </xsl:when>
        <xsl:when test="/article/articleinfo//othercredit/@role='reviewer'">
          <xsl:apply-templates select="/article/articleinfo" mode="reviewersect"/>
        </xsl:when>
      </xsl:choose>

    </xsl:with-param>
  </xsl:call-template>
  <!-- Now generate stub include pages for every page documented in
       this refentry (except the page itself) -->
  <xsl:for-each select="refnamediv/refname">
    <xsl:if test=". != $name">
      <xsl:call-template name="write-page">
	<xsl:with-param name="filename" select="concat(., '.', $section)"/>
	<xsl:with-param name="contents"
	  select="concat('.so man', $section, '/', $name, '.', $section, '&#10;')"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:for-each>
</xsl:template>

<xsl:template match="articleinfo|bookinfo|refentryinfo" mode="authorsect">
  <xsl:text>.SH AUTEUR</xsl:text>
  <xsl:if test="count(.//author)>1">
    <xsl:text>S</xsl:text>
  </xsl:if>
  <xsl:text>&#10;</xsl:text>

  <xsl:for-each select=".//author">
    <xsl:if test="position() > 1">
      <xsl:text>, </xsl:text>
    </xsl:if>
    <xsl:apply-templates select="."/>
  </xsl:for-each>
  <xsl:text>.&#10;</xsl:text>
  <xsl:if test=".//editor">
    <xsl:text>.br&#10;Man page edited by </xsl:text>
    <xsl:apply-templates select=".//editor"/>
    <xsl:text>.&#10;</xsl:text>
  </xsl:if>
</xsl:template>

<xsl:template match="articleinfo|bookinfo|refentryinfo" mode="translationsect">
  <xsl:text>.SH TRADUCTION</xsl:text>
  <xsl:text>&#10;</xsl:text>
  <xsl:for-each select=".//othercredit/@role='translation'">
    <xsl:if test="position() > 1">
      <xsl:text>, </xsl:text>
    </xsl:if>
    <xsl:apply-templates select="."/>
  </xsl:for-each>
  <xsl:apply-templates/>
  <xsl:text>.&#10;</xsl:text>
</xsl:template>

<xsl:template match="articleinfo|bookinfo|refentryinfo" mode="reviewersect">
  <xsl:text>.SH RELECTURE</xsl:text>
  <xsl:text>&#10;</xsl:text>
  <xsl:for-each select=".//othercredit/@role='reviewer'">
    <xsl:if test="position() > 1">
      <xsl:text>, </xsl:text>
    </xsl:if>
    <xsl:apply-templates select="."/>
  </xsl:for-each>
  <xsl:apply-templates/>
  <xsl:text>.&#10;</xsl:text>
</xsl:template>

<xsl:template match="othercredit">
  <xsl:call-template name="person.name"/>
  <xsl:apply-templates select=".//email"/>
  <xsl:apply-templates select=".//contrib"/>
</xsl:template>

<xsl:template match="refnamediv">
  <xsl:text>.SH NOM
</xsl:text>
  <xsl:for-each select="refname">
    <xsl:if test="position()>1">
      <xsl:text>, </xsl:text>
    </xsl:if>
    <xsl:value-of select="."/>
  </xsl:for-each>
  <xsl:text> \- </xsl:text>
  <xsl:value-of select="normalize-space(refpurpose)"/>
</xsl:template>

      <!-- Définir mise en gras : ajout le 14 avril 2003 -->

<xsl:template match="engras">
  <xsl:text>\fB</xsl:text><xsl:apply-templates/><xsl:text>\fR</xsl:text>
</xsl:template>

      <!-- Définir mise en gras : ajout le 14 avril 2003 -->

</xsl:stylesheet>

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]