dion        02/01/23 17:17:22

  Modified:    latka/xsl/site docbook2document.xsl
  Log:
  Added simplelist, member, and xref handling
  
  Revision  Changes    Path
  1.14      +50 -16    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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- docbook2document.xsl      23 Jan 2002 08:38:01 -0000      1.13
  +++ docbook2document.xsl      24 Jan 2002 01:17:22 -0000      1.14
  @@ -4,12 +4,15 @@
       Author:     Berin Loritsch ([EMAIL PROTECTED])
       Author:     Peter Donald  ([EMAIL PROTECTED])
       Author:     dIon Gillard ([EMAIL PROTECTED])
  -    Version:    $Id: docbook2document.xsl,v 1.13 2002/01/23 08:38:01 dion Exp $
  +    Version:    $Id: docbook2document.xsl,v 1.14 2002/01/24 01:17:22 dion Exp $
       FIXME:      Doesn't handle attributes of informaltable and other docbook 
elements
     -->
   
   <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
  +    <!-- used for cross ref links (xref) -->
  +    <xsl:key name="id" match="*" use="@id"/>
   
  +    <!-- top level component templates -->
       <xsl:template match="book">
           <document>
               <properties>
  @@ -83,17 +86,14 @@
   
       <xsl:template match="title|subtitle"/>
   
  +    <!-- author block -->
       <!-- FIXME: Where would this match? -->
       <xsl:template match="author">
  -        <p>
  +        <p>Author: 
               <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>
           <ul>
  @@ -126,6 +126,7 @@
   
       <xsl:template 
match="honorific|firstname|surname|orgdiv|orgname|shortaffil|jobtitle"/>
   
  +    <!-- revision history -->
       <xsl:template match="revhistory">
           <section name="Revision History">
               <xsl:variable name="unique-revisions" 
select="revision[not(revnumber=preceding-sibling::revision/revnumber)]/revnumber"/>
  @@ -143,12 +144,6 @@
           </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>
  @@ -175,12 +170,14 @@
   
       <xsl:template match="revnumber|revremark|authorinitials|date"/>
   
  +    <!-- sections - and nested -->
       <xsl:template match="section">
           <xsl:param name="level"/>
   
           <xsl:choose>
               <xsl:when test="number($level)=1">
                   <section name="{title}">
  +                    <xsl:if test="@id"><a name="{@id}"> </a></xsl:if>
                       <xsl:apply-templates>
                           <xsl:with-param name="level" select="number($level)+1"/>
                       </xsl:apply-templates>
  @@ -188,13 +185,15 @@
               </xsl:when>
               <xsl:when test="number($level)=2">
                   <subsection name="{title}">
  +                    <xsl:if test="@id"><a name="{@id}"> </a></xsl:if>
                       <xsl:apply-templates>
                           <xsl:with-param name="level" select="number($level)+1"/>
                       </xsl:apply-templates>
                   </subsection>
               </xsl:when>
               <xsl:otherwise>
  -                <p><b><xsl:value-of select="title"/></b><br/>
  +                <p><a name="{@name}"><strong><xsl:value-of 
select="title"/></strong></a><br />
  +                    <xsl:if test="@id"><a name="{@id}"> </a></xsl:if>
                       <xsl:apply-templates>
                           <xsl:with-param name="level" select="number($level)+1"/>
                       </xsl:apply-templates>
  @@ -202,7 +201,15 @@
               </xsl:otherwise>
           </xsl:choose>
       </xsl:template>
  +    
  +    <!-- paragraphs/textual elements -->
  +    <xsl:template match="para">
  +        <p><xsl:apply-templates/></p>
  +    </xsl:template>
   
  +    <xsl:template match="emphasis"><em><xsl:apply-templates/></em></xsl:template>
  +
  +    <!-- book details --> 
       <xsl:template match="bookinfo">
           <b><xsl:value-of select="edition"/></b><xsl:text> </xsl:text>
           <i>pub. <xsl:value-of select="pubdate"/></i>
  @@ -228,16 +235,17 @@
           <xsl:apply-templates/>
       </xsl:template>
   
  +    <!-- lists etc -->
       <xsl:template match="programlisting">
           <source><xsl:apply-templates/></source>
       </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="itemizedlist"><ul><xsl:apply-templates/></ul></xsl:template>
  +    <xsl:template 
match="listitem|member"><li><xsl:apply-templates/></li></xsl:template>
   
  +    <xsl:template 
match="itemizedlist|simplelist"><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="blockquote">
  @@ -256,8 +264,34 @@
           <p><xsl:apply-templates/></p>
       </xsl:template>
   
  +    <!-- links -->
       <xsl:template match="ulink"><a 
href="{@url}"><xsl:apply-templates/></a></xsl:template>
  +    <xsl:template match="xref">
  +        <!--
  +            make a link to the linkend specified, prefixing with a # since it's
  +            internal to the generated html. The text of the link should be either
  +            a) element pointed to by linkend's xreflabel or
  +            b) endterm content
  +         -->
  +        <xsl:variable name="link-targets" select="key('id',@linkend)"/>
  +        <xsl:variable name="link-target" select="$link-targets[1]"/>
  +
  +        <a href="#{@linkend}">
  +            <!-- xreflabel of target goes here-->
  +            <xsl:choose>
  +                <xsl:when test="$link-target/@xreflabel">
  +                    <xsl:value-of select="$link-target/@xreflabel"/>
  +                </xsl:when>
  +                <xsl:otherwise>
  +                    <xsl:variable name="endterm-targets" 
select="key('id',@endterm)"/>
  +                    <xsl:variable name="endterm-target" 
select="$endterm-targets[1]"/>
  +                    <xsl:apply-templates select="$endterm-target"/>
  +                </xsl:otherwise>
  +            </xsl:choose>
  +        </a>
  +    </xsl:template>
   
  +    <!-- tables, footnotes etc -->
       <xsl:template match="footnote">
           <sup><a href="#{generate-id(.)}"><xsl:value-of select="generate-id(.)"/></a>
           </sup>
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to