commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/latka/xsl/site docbook2document.xsl
Date Mon, 21 Jan 2002 06:16:24 GMT
dion        02/01/20 22:16:24

  Modified:    latka/xsl/site docbook2document.xsl
  Log:
  FIxed formatting of stylesheet
  
  Revision  Changes    Path
  1.7       +223 -218  jakarta-commons/latka/xsl/site/docbook2document.xsl
  
  Index: docbook2document.xsl
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/xsl/site/docbook2document.xsl,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- docbook2document.xsl	21 Jan 2002 05:23:08 -0000	1.6
  +++ docbook2document.xsl	21 Jan 2002 06:16:23 -0000	1.7
  @@ -2,7 +2,7 @@
   <!--
       Author:     (insert avalon author here)
       Author:     dIon Gillard
  -    Version:    $Id: docbook2document.xsl,v 1.6 2002/01/21 05:23:08 dion Exp $
  +    Version:    $Id: docbook2document.xsl,v 1.7 2002/01/21 06:16:23 dion Exp $
       FIXME:      Doesn't handle attributes of informaltable, book xsl template
                   is broken
     -->
  @@ -11,32 +11,35 @@
   
       <!-- FIXME: needs updating to similar format as chapter -->
       <xsl:template match="book">
  -        <body>
  -            <title><xsl:value-of select="title"/></title>
  -            <center>
  -                <table width="80%">
  -                    <tr>
  -                        <td bgcolor="#F3DD61">
  -                            <br/>
  -                            <center>
  -                                <b>
  -                                <font color="#000000" face="arial,helvetica,sanserif">
  -                                    <xsl:value-of select="title"/>
  -                                    <xsl:if test="subtitle"><xsl:text>: </xsl:text>
  -                                        <xsl:value-of select="subtitle"/>
  -                                    </xsl:if>
  -                                </font>
  -                                </b>
  -                            </center>
  -                            <br/>
  -                        </td>
  -                    </tr>
  -                </table>
  -            </center>
  -            <br/>
  -            <xsl:apply-templates select="dedication"/>
  -            <xsl:apply-templates select="bookinfo"/>
  -        </body>
  +        <document>
  +            <properties>
  +                <title>
  +                    <xsl:value-of select="title"/>
  +                    <xsl:if test="subtitle">
  +                        (<xsl:value-of select="subtitle"/>)
  +                    </xsl:if>
  +                </title>
  +                <xsl:for-each select="//authorgroup/author">
  +                    <author email="{affiliation/address/email}">
  +                        <xsl:if test="honorific"><xsl:value-of select="honorific"/>.
</xsl:if>
  +                        <xsl:if test="firstname">
  +                            <xsl:value-of select="firstname"/>
  +                            <xsl:text> </xsl:text>
  +                        </xsl:if>
  +                        <xsl:value-of select="surname"/>
  +                    </author>
  +                </xsl:for-each>
  +                <!-- always have the following as an author -->
  +                <author email="commons-dev@jakarta.apache.org">
  +                    Commons Documentation Team
  +                </author>
  +            </properties>
  +
  +            <body>
  +                <xsl:apply-templates select="dedication"/>
  +                <xsl:apply-templates select="bookinfo"/>
  +            </body>
  +        </document>    
       </xsl:template>
   
       <!-- 
  @@ -67,111 +70,117 @@
                   </author>
               </properties>
   
  -            <!-- FIXME: 
  -            plan to remove all html formatting from the stylesheet unless it's
  -            translating the docbook tags across -->
               <body>
   
  -            <xsl:apply-templates select="para"/>
  +                <xsl:apply-templates select="para"/>
  +
  +                <xsl:apply-templates select="section">
  +                    <xsl:with-param name="level" select="1"/>
  +                </xsl:apply-templates>
  +
  +                <xsl:apply-templates select="//footnote" mode="base"/>
  +            </body>
  +        </document>
  +    </xsl:template>
  +
  +    <xsl:template match="title|subtitle"/>
   
  -          <xsl:apply-templates select="section">
  -            <xsl:with-param name="level" select="1"/>
  -          </xsl:apply-templates>
  -
  -          <xsl:apply-templates select="//footnote" mode="base"/>
  -        </body>
  -    </document>
  -  </xsl:template>
  -
  -  <xsl:template match="title|subtitle"/>
  -
  -  <!-- FIXME: Where would this match? -->
  -  <xsl:template match="author">
  -      <p>
  +    <!-- FIXME: Where would this match? -->
  +    <xsl:template match="author">
  +        <p>
  +            <xsl:value-of select="honorific"/><xsl:text>. </xsl:text>
  +            <xsl:value-of select="firstname"/><xsl:text> </xsl:text>
  +            <xsl:value-of select="surname"/>
  +        </p>
  +        <xsl:text>Author: </xsl:text>
           <xsl:value-of select="honorific"/><xsl:text>. </xsl:text>
           <xsl:value-of select="firstname"/><xsl:text> </xsl:text>
           <xsl:value-of select="surname"/>
  -      </p>
  -      <xsl:text>Author: </xsl:text>
  -      <xsl:value-of select="honorific"/><xsl:text>. </xsl:text>
  -      <xsl:value-of select="firstname"/><xsl:text> </xsl:text>
  -      <xsl:value-of select="surname"/>
         
  -      <xsl:text>Affiliations</xsl:text>
  +        <xsl:text>Affiliations</xsl:text>
           <ul>
  -          <xsl:apply-templates select="affiliation"/>
  +            <xsl:apply-templates select="affiliation"/>
           </ul>
  -      <xsl:apply-templates select="authorblurb"/>
  -  </xsl:template>
  +        <xsl:apply-templates select="authorblurb"/>
  +    </xsl:template>
   
  -  <xsl:template match="affiliation">
  -    <li>
  -      <xsl:text>[</xsl:text><xsl:value-of select="shortaffil"/><xsl:text>]
</xsl:text>
  -      <b><xsl:value-of select="jobtitle"/></b>
  -      <i><xsl:value-of select="orgname"/><xsl:if test="orgdiv"><xsl:text>/</xsl:text><xsl:value-of
select="orgdiv"/></xsl:if></i>
  -    </li>
  -  </xsl:template>
  -
  -  <xsl:template match="authorblurb">
  -    <xsl:text>Bio</xsl:text>
  -    <ul>
  -        <xsl:apply-templates/>
  -    </ul>
  -  </xsl:template>
  +    <xsl:template match="affiliation">
  +        <li>
  +            <xsl:text>[</xsl:text>
  +            <xsl:value-of select="shortaffil"/>
  +            <xsl:text>] </xsl:text>
  +            <b><xsl:value-of select="jobtitle"/></b>
  +            <i><xsl:value-of select="orgname"/>
  +                <xsl:if test="orgdiv">
  +                    <xsl:text>/</xsl:text>
  +                    <xsl:value-of select="orgdiv"/>
  +                </xsl:if>
  +            </i>
  +        </li>
  +    </xsl:template>
   
  -  <xsl:template match="honorific|firstname|surname|orgdiv|orgname|shortaffil|jobtitle"/>
  +    <xsl:template match="authorblurb">
  +        <xsl:text>Bio</xsl:text>
  +        <ul>
  +            <xsl:apply-templates/>
  +        </ul>
  +    </xsl:template>
  +
  +    <xsl:template
  +        match="honorific|firstname|surname|orgdiv|orgname|shortaffil|jobtitle"/>
  +
  +    <xsl:template match="revhistory">
  +        <section name="Revision History">
  +            <xsl:variable name="unique-revisions" 
  +                          select="revision[not(revnumber=preceding-sibling::revision/revnumber)]/revnumber"/>
  +
  +            <xsl:variable name="base" select="."/>
  +
  +            <xsl:for-each select="$unique-revisions">
  +                <p>Revision <xsl:value-of select="."/> 
  +                    (<xsl:value-of select="$base/revision[revnumber=current()]/date"/>)
  +                </p>
  +                <ul>
  +                    <xsl:apply-templates 
  +                        select="$base/revision[revnumber=current()]"/>
  +                </ul>
  +            </xsl:for-each>
  +        </section>
  +    </xsl:template>
   
  -  <xsl:template match="revhistory">
  -      <section name="Revision History">
  -          <xsl:variable name="unique-revisions" 
  -            select="revision[not(revnumber=preceding-sibling::revision/revnumber)]/revnumber"/>
  -
  -          <xsl:variable name="base" select="."/>
  -
  -          <xsl:for-each select="$unique-revisions">
  -          <p>Revision <xsl:value-of select="."/> 
  -               (<xsl:value-of select="$base/revision[revnumber=current()]/date"/>)
  -          </p>
  -          <ul>
  -            <xsl:apply-templates select="$base/revision[revnumber=current()]"/>
  -          </ul>
  -          </xsl:for-each>
  -      </section>
  -  </xsl:template>
  -
  -  <xsl:template match="para">
  -    <p><xsl:apply-templates/></p>
  -  </xsl:template>
  -
  -  <xsl:template match="emphasis"><em><xsl:apply-templates/></em></xsl:template>
  -
  -  <xsl:template match="revision">
  -    <li>
  -      <xsl:choose>
  -        <xsl:when test="@revisionflag='added'">
  -          <img align="absmiddle" alt="added" border="0" src="images/add.jpg"/>
  -        </xsl:when>
  -        <xsl:when test="@revisionflag='changed'">
  -          <img align="absmiddle" alt="changed" border="0" src="images/update.jpg"/>
  -        </xsl:when>
  -        <xsl:when test="@revisionflag='deleted'">
  -          <img align="absmiddle" alt="deleted" border="0" src="images/remove.jpg"/>
  -        </xsl:when>
  -        <xsl:when test="@revisionflag='off'">
  -          <img align="absmiddle" alt="off" border="0" src="images/fix.jpg"/>
  -        </xsl:when>
  -        <xsl:otherwise>
  -          <img align="absmiddle" alt="changed" border="0" src="images/update.jpg"/>
  -        </xsl:otherwise>
  -      </xsl:choose>
  -      <xsl:value-of select="revremark"/>
  -      <xsl:text> (</xsl:text><xsl:value-of select="authorinitials"/><xsl:text>)</xsl:text>
  -    </li>
  -  </xsl:template>
  +    <xsl:template match="para">
  +        <p><xsl:apply-templates/></p>
  +    </xsl:template>
   
  -  <xsl:template match="revnumber|revremark|authorinitials|date"/>
  +    <xsl:template match="emphasis"><em><xsl:apply-templates/></em></xsl:template>
  +
  +    <xsl:template match="revision">
  +        <li>
  +            <xsl:choose>
  +                <xsl:when test="@revisionflag='added'">
  +                    <img align="absmiddle" alt="added" border="0" src="images/add.jpg"/>
  +                </xsl:when>
  +                <xsl:when test="@revisionflag='changed'">
  +                    <img align="absmiddle" alt="changed" border="0" src="images/update.jpg"/>
  +                </xsl:when>
  +                <xsl:when test="@revisionflag='deleted'">
  +                    <img align="absmiddle" alt="deleted" border="0" src="images/remove.jpg"/>
  +                </xsl:when>
  +                <xsl:when test="@revisionflag='off'">
  +                    <img align="absmiddle" alt="off" border="0" src="images/fix.jpg"/>
  +                </xsl:when>
  +                <xsl:otherwise>
  +                    <img align="absmiddle" alt="changed" border="0" src="images/update.jpg"/>
  +                </xsl:otherwise>
  +            </xsl:choose>
  +            <xsl:value-of select="revremark"/>
  +            <xsl:text> (</xsl:text><xsl:value-of select="authorinitials"/><xsl:text>)</xsl:text>
  +        </li>
  +    </xsl:template>
   
  -  <xsl:template match="section">
  +    <xsl:template match="revnumber|revremark|authorinitials|date"/>
  +
  +    <xsl:template match="section">
           <xsl:param name="level"/>
   
           <xsl:choose>
  @@ -197,141 +206,137 @@
                   </p>    
               </xsl:otherwise>
           </xsl:choose>
  -  </xsl:template>
  +    </xsl:template>
  +
  +    <xsl:template match="bookinfo">
  +        <b><xsl:value-of select="edition"/></b><xsl:text> </xsl:text>
  +        <i>pub. <xsl:value-of select="pubdate"/></i>
  +        <xsl:apply-templates/>
  +    </xsl:template>
  +
  +    <xsl:template match="dedication">
  +        <b>Dedication</b>
  +        <xsl:apply-templates/>
  +    </xsl:template>
  +
  +    <xsl:template match="edition|pubdate|year|holder"/>
  +
  +    <xsl:template match="copyright">
  +        <p>Copyright &#x00A9;<xsl:value-of select="year"/> by 
  +            <xsl:value-of select="holder"/>.<br/>
  +            <i>All rights reserved.</i>
  +        </p>
  +    </xsl:template>
   
  -  <xsl:template match="bookinfo">
  -      <b><xsl:value-of select="edition"/></b><xsl:text> </xsl:text>
  -      <i>pub. <xsl:value-of select="pubdate"/></i>
  -      <xsl:apply-templates/>
  -  </xsl:template>
  -
  -  <xsl:template match="dedication">
  -      <b>Dedication</b>
  -      <xsl:apply-templates/>
  -  </xsl:template>
  -
  -  <xsl:template match="edition|pubdate|year|holder"/>
  -
  -  <xsl:template match="copyright">
  -    <p>Copyright &#x00A9;<xsl:value-of select="year"/> by 
  -        <xsl:value-of select="holder"/>.<br/>
  -      <i>All rights reserved.</i>
  -    </p>
  -  </xsl:template>
  -
  -  <xsl:template match="legalnotice">
  -    <p>Legal Notice</p>
  -    <xsl:apply-templates/>
  -  </xsl:template>
  +    <xsl:template match="legalnotice">
  +        <p>Legal Notice</p>
  +        <xsl:apply-templates/>
  +    </xsl:template>
   
  -  <xsl:template match="programlisting">
  +    <xsl:template match="programlisting">
           <pre><xsl:apply-templates/></pre>
  -  </xsl:template>
  +    </xsl:template>
   
  -  <xsl:template match="orderedlist"><ol><xsl:apply-templates/></ol></xsl:template>
  +    <xsl:template match="orderedlist"><ol><xsl:apply-templates/></ol></xsl:template>
   
  -  <xsl:template match="listitem"><li><xsl:apply-templates/></li></xsl:template>
  +    <xsl:template match="listitem"><li><xsl:apply-templates/></li></xsl:template>
   
  -  <xsl:template match="itemizedlist"><ul><xsl:apply-templates/></ul></xsl:template>
  +    <xsl:template match="itemizedlist"><ul><xsl:apply-templates/></ul></xsl:template>
   
  -  <xsl:template match="classname|function|parameter"><code><xsl:apply-templates/><xsl:if
test="name(.)='function'"><xsl:text>()</xsl:text></xsl:if></code></xsl:template>
  +    <xsl:template match="classname|function|parameter"><code><xsl:apply-templates/><xsl:if
test="name(.)='function'"><xsl:text>()</xsl:text></xsl:if></code></xsl:template>
   
  -  <xsl:template match="blockquote">
  +    <xsl:template match="blockquote">
           <xsl:if test="title">
  -            <blockquote><xsl:value-of select="title"/></blockquote>
  +            <blockquote><xsl:value-of select="title"/><br />
  +            <xsl:apply-templates/>
  +            </blockquote>
           </xsl:if>
  -        <p><xsl:apply-templates/></p>
  -  </xsl:template>
  +        <p></p>
  +    </xsl:template>
   
  -  <xsl:template match="warning">
  +    <xsl:template match="warning">
           <xsl:if test="title">
               <p><em><xsl:value-of select="title"/></em></p>
           </xsl:if>
           <p><xsl:apply-templates/></p>
  -  </xsl:template>
  +    </xsl:template>
   
  -  <xsl:template match="ulink"><a href="{@url}"><xsl:apply-templates/></a></xsl:template>
  +    <xsl:template match="ulink"><a href="{@url}"><xsl:apply-templates/></a></xsl:template>
   
  -  <xsl:template match="footnote">
  -    <sup><a href="#{generate-id(.)}"><xsl:value-of select="generate-id(.)"/></a>
  -    </sup>
  -  </xsl:template>
  +    <xsl:template match="footnote">
  +        <sup><a href="#{generate-id(.)}"><xsl:value-of select="generate-id(.)"/></a>
  +        </sup>
  +    </xsl:template>
   
  -  <xsl:template match="footnote" mode="base">
  -      <a name="{generate-id(.)}"/><xsl:value-of select="generate-id(.)"/><xsl:text>)
</xsl:text><i><xsl:value-of select="."/></i>
  -  </xsl:template>
  +    <xsl:template match="footnote" mode="base">
  +        <a name="{generate-id(.)}"/><xsl:value-of select="generate-id(.)"/><xsl:text>)
</xsl:text><i><xsl:value-of select="."/></i>
  +    </xsl:template>
   
  -  <xsl:template match="figure">
  +    <xsl:template match="figure">
           <p>Figure: <xsl:value-of select="title"/></p>
           <xsl:apply-templates/>
  -  </xsl:template>
  +    </xsl:template>
   
  -  <xsl:template match="graphic">
  +    <xsl:template match="graphic">
           <img border="0" alt="{@srccredit}" src="{@fileref}"/>
           <xsl:if test="@srccredit">
               <ul><li><xsl:value-of select="@srccredit"/></li></ul>
           </xsl:if>
  -  </xsl:template>
  +    </xsl:template>
  +
  +    <xsl:template match="table"><table><xsl:apply-templates/></table></xsl:template>
  +
  +    <!-- FIXME: support attributes of informal table here -->
  +    <xsl:template match="informaltable">
  +        <table border="1"><xsl:apply-templates/></table>
  +    </xsl:template>
  +
  +    <xsl:template match="tgroup">
  +        <xsl:apply-templates select="thead|tbody|tfoot"/>
  +    </xsl:template>
  +
  +    <xsl:template match="thead">
  +        <xsl:apply-templates select="row" mode="head"/>
  +    </xsl:template>
  +
  +    <xsl:template match="row" mode="head">
  +        <tr><xsl:apply-templates select="entry" mode="head"/></tr>
  +    </xsl:template>
   
  -  <xsl:template match="table">
  -    <table>
  -      <xsl:apply-templates/>
  -    </table>
  -  </xsl:template>
  -
  -  <!-- FIXME: support attributes of informal table here -->
  -  <xsl:template match="informaltable">
  -    <table border="1">
  -      <xsl:apply-templates/>
  -    </table>
  -  </xsl:template>
  -
  -  <xsl:template match="tgroup">
  -    <xsl:apply-templates select="thead|tbody|tfoot"/>
  -  </xsl:template>
  -
  -  <xsl:template match="thead">
  -    <xsl:apply-templates select="row" mode="head"/>
  -  </xsl:template>
  -
  -  <xsl:template match="row" mode="head">
  -    <tr><xsl:apply-templates select="entry" mode="head"/></tr>
  -  </xsl:template>
  -
  -  <xsl:template match="row">
  -    <tr><xsl:apply-templates/></tr>
  -  </xsl:template>
  -
  -  <xsl:template match="tbody|tfoot">
  -    <xsl:apply-templates/>
  -  </xsl:template>
  +    <xsl:template match="row">
  +        <tr><xsl:apply-templates/></tr>
  +    </xsl:template>
   
  -  <xsl:template match="entry" mode="head">
  +    <xsl:template match="tbody|tfoot">
  +        <xsl:apply-templates/>
  +    </xsl:template>
  +
  +    <xsl:template match="entry" mode="head">
           <th><xsl:apply-templates/></th>
  -  </xsl:template>
  +    </xsl:template>
     
  -  <xsl:template match="entry">
  +    <xsl:template match="entry">
           <td><xsl:apply-templates/></td>
  -  </xsl:template>
  +    </xsl:template>
   
  -  <xsl:template match="firstterm">
  -    <i><xsl:apply-templates/></i>
  -  </xsl:template>
  +    <xsl:template match="firstterm">
  +        <i><xsl:apply-templates/></i>
  +    </xsl:template>
     
  -  <xsl:template match="remark">
  -    <p><b>Note:</b> <xsl:apply-templates/></p>
  -  </xsl:template>
  +    <xsl:template match="remark">
  +        <p><b>Note:</b> <xsl:apply-templates/></p>
  +    </xsl:template>
     
  -  <xsl:template match="sgmltag">
  -    <code><xsl:apply-templates/></code>
  -  </xsl:template>
  +    <xsl:template match="sgmltag">
  +        <code><xsl:apply-templates/></code>
  +    </xsl:template>
     
  -  <xsl:template match="trademark"><xsl:apply-templates/><sup>TM</sup></xsl:template>
  +    <xsl:template match="trademark"><xsl:apply-templates/><sup>TM</sup></xsl:template>
   
  -  <xsl:template match="node()|@*" priority="-1">
  -    <xsl:copy>
  -      <xsl:apply-templates select="node()|@*"/>
  -    </xsl:copy>
  -  </xsl:template>
  +    <xsl:template match="node()|@*" priority="-1">
  +        <xsl:copy>
  +            <xsl:apply-templates select="node()|@*"/>
  +        </xsl:copy>
  +    </xsl:template>
     
   </xsl:stylesheet>
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message