forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From che...@apache.org
Subject cvs commit: xml-forrest/src/resources/skins/common/xslt/fo document2fo.xsl
Date Tue, 16 Sep 2003 23:12:13 GMT
cheche      2003/09/16 16:12:13

  Modified:    .        status.xml
               src/resources/skins/common/xslt/fo document2fo.xsl
  Log:
  Added creation of TOC support on PDF files.
  Improved so it uses value from skinconfig.xml.
  Improve algorithm to define font size for section/subsection/...
  Submitted by: Eric Burghard eburghar@free.fr
  
  Revision  Changes    Path
  1.218     +7 -1      xml-forrest/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/xml-forrest/status.xml,v
  retrieving revision 1.217
  retrieving revision 1.218
  diff -u -r1.217 -r1.218
  --- status.xml	16 Sep 2003 16:35:08 -0000	1.217
  +++ status.xml	16 Sep 2003 23:12:13 -0000	1.218
  @@ -25,6 +25,12 @@
   
     <changes>
       <release version="0.6-dev" date="unreleased">
  +      <action dev="JJP" type="update" context="core"
  +        due-to="Eric Burghard" due-to-email="eburghar@free.fr" >
  +        Added creation of TOC support on PDF files.
  +	Improved so it uses value from skinconfig.xml.
  +	Improve algoritm to define font size for section/subsection/...
  +      </action>
         <action dev="JJP" type="add" context="core" fixes-bug="FOR-9" >
          First I18n integration for menus in forrest.
         </action>
  
  
  
  1.17      +50 -9     xml-forrest/src/resources/skins/common/xslt/fo/document2fo.xsl
  
  Index: document2fo.xsl
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/skins/common/xslt/fo/document2fo.xsl,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- document2fo.xsl	12 Sep 2003 10:25:55 -0000	1.16
  +++ document2fo.xsl	16 Sep 2003 23:12:13 -0000	1.17
  @@ -4,7 +4,12 @@
                   xmlns:fo="http://www.w3.org/1999/XSL/Format"
                   version="1.0">
   
  -  <xsl:output method="xml"/>
  +  <!-- the skinconf file -->
  +  <xsl:param name="config-file" select="'../../../../skinconf.xml'"/>
  +  <xsl:variable name="config" select="document($config-file)/skinconfig"/>
  +  <!-- Get the section depth to use when generating the minitoc (default is 2) -->
  +  <xsl:variable name="toc-max-depth" select="number($config/toc/@level)"/>
  +
     <xsl:param name="numbersections" select="'true'"/>
   
     <!-- Section depth at which we stop numbering and just indent -->
  @@ -218,14 +223,8 @@
       <xsl:param name="level">0</xsl:param>
   
       <xsl:variable name="size">
  -      <xsl:choose>
  -        <xsl:when test="number($level) = 1">
  -          <xsl:value-of select="14"/>
  -        </xsl:when>
  -        <xsl:otherwise>
  -          <xsl:value-of select="12"/>
  -        </xsl:otherwise>
  -      </xsl:choose>
  +      <!-- 14pt for level 1 12pt for level 2 -->
  +      <xsl:value-of select="14-number($level)"/>
       </xsl:variable>
       
       <fo:block
  @@ -688,6 +687,48 @@
         font-size="8pt">
         <xsl:apply-templates/>
       </fo:inline>
  +  </xsl:template>
  +
  +  <xsl:template match="body[count(//section) != 0]">
  +    <xsl:if test="$toc-max-depth > 0">
  +      <fo:block font-family="serif" font-size="14pt" font-weight="bold" 
  +      space-after="5pt" space-before="5pt" text-align="justify" width="7.5in"> 
  +        <!-- insert i18n stuff here -->
  +        <xsl:text>Table of contents</xsl:text>
  +      </fo:block>
  +      <fo:block font-family="sans" font-size="12pt" space-after="5pt" 
  +      space-before="0pt" text-align="justify" width="7.5in">
  +          <xsl:apply-templates select="section" mode="toc" />
  +      </fo:block>
  +    </xsl:if>
  +    <xsl:apply-templates />
  +  </xsl:template>
  +
  +  <xsl:template match="section" mode="toc">
  +    <fo:block space-before="5pt" text-align-last="justify">
  +      <fo:inline>
  +        <xsl:number count="section" format="1.1.1.1.1.1.1" level="multiple" />
  +        <xsl:text>. </xsl:text>
  +        <xsl:value-of select="title" />
  +        <fo:leader leader-pattern="dots" />
  +        <fo:page-number-citation ref-id="{generate-id(  )}" />
  +      </fo:inline>
  +        <xsl:if test="$toc-max-depth > 1">
  +          <xsl:apply-templates select="section" mode="toc2" /> 
  +        </xsl:if>
  +    </fo:block>
  +  </xsl:template>
  +
  +  <xsl:template match="section" mode="toc2">
  +    <fo:block start-indent=".5em" text-align-last="justify" text-indent=".5em">
  +      <fo:inline padding-start="1em">
  +        <xsl:number count="section" format="1.1.1.1.1.1.1" level="multiple" />
  +        <xsl:text>. </xsl:text>
  +        <xsl:value-of select="title" />
  +        <fo:leader leader-pattern="dots" />
  +        <fo:page-number-citation ref-id="{generate-id(  )}" />
  +      </fo:inline>
  +    </fo:block>
     </xsl:template>
   
   <!-- ====================================================================== -->
  
  
  

Mime
View raw message