forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stev...@apache.org
Subject cvs commit: xml-forrest/src/resources/skins/common/xslt/fo document2fo.xsl pdfoutline.xsl
Date Wed, 04 Dec 2002 14:14:30 GMT
stevenn     2002/12/04 06:14:30

  Modified:    src/resources/skins/common/xslt/fo document2fo.xsl
                        pdfoutline.xsl
  Log:
  FOP PDF rendition patches kindly supplied by Keiron Liddle <keiron@aftexsw.com>
  
  - separates internal and external link
  - adds anchor and id blocks for section
  - made author more consistent
  - removed author from pdf outline since it did not handle no author or multiple authors
  - added alt text for images
  
  Revision  Changes    Path
  1.4       +45 -6     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- document2fo.xsl	3 Dec 2002 00:23:19 -0000	1.3
  +++ document2fo.xsl	4 Dec 2002 14:14:29 -0000	1.4
  @@ -84,14 +84,15 @@
         </fo:layout-master-set>
   
         <xsl:apply-templates select="/document" mode="outline"/>
  -      
  +
         <fo:page-sequence master-reference="book">
  +        <fo:title><xsl:value-of select="document/header/title"/></fo:title>
           <xsl:apply-templates/>
         </fo:page-sequence>
         
       </fo:root>
     </xsl:template>
  -  
  +
     <xsl:template match="document">
       <fo:title><xsl:value-of select="header/title"/></fo:title>
       
  @@ -198,6 +199,11 @@
       </fo:block>
     </xsl:template>
   
  +  <xsl:template match="anchor">
  +    <fo:block id="{@id}"/>
  +    <xsl:apply-templates/>
  +  </xsl:template>
  +
     <xsl:template match="section">
       
       <xsl:param name="level">0</xsl:param>
  @@ -213,6 +219,11 @@
         <xsl:number format="1.1.1.1.1.1.1" count="section" level="multiple"/>
         <xsl:text> </xsl:text>
         <xsl:value-of select="title"/>
  +
  +      <xsl:if test="normalize-space(@id)!=''">
  +        <fo:block id="{@id}"/>
  +      </xsl:if>
  +
       </fo:block>
       <xsl:apply-templates>
         <xsl:with-param name="level" select="number($level)+1"/>
  @@ -240,8 +251,9 @@
         space-before="20pt"
         font-weight="bold"
         font-size="9pt">
  +      by
         <xsl:for-each select="person">
  -        <xsl:value-of select="@name"/>, <xsl:value-of select="@email"/>
  +        <xsl:value-of select="@name"/>
           <xsl:if test="not(position() = last())">, </xsl:if>
         </xsl:for-each>
       </fo:block>
  @@ -263,6 +275,9 @@
         font-size="10pt"
         background-color="#f0f0f0"
         white-space-collapse="false"
  +      linefeed-treatment="preserve"
  +      white-space-treatment="preserve"
  +      wrap-option="no-wrap"
         text-align="start">
         <xsl:apply-templates/>
       </fo:block>
  @@ -464,13 +479,37 @@
     </xsl:template>
   
     <xsl:template match="link">
  +    <xsl:choose>
  +      <xsl:when test="starts-with(@href, '#')">
  +    <fo:basic-link color="blue" text-decoration="underline" internal-destination="{substring(@href,2)}">
  +      <xsl:apply-templates/>
  +    </fo:basic-link>
  +      </xsl:when>
  +      <xsl:otherwise>
       <fo:basic-link color="blue" text-decoration="underline" external-destination="{@href}"><xsl:apply-templates/></fo:basic-link>
  +      </xsl:otherwise>
  +    </xsl:choose>
     </xsl:template>
   
     <xsl:template match="figure">
  -    <!-- FIXME: Images are not found at the moment -->
  -    <fo:external-graphic src="{@src}"/>
  -    <!-- alt text and credits need inserting -->
  +    <fo:block text-align="center">
  +      <xsl:if test="normalize-space(@id)!=''">
  +          <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
  +      </xsl:if>
  +      <fo:external-graphic src="{@src}" content-width="scale-to-fit"
  +                           content-height="scale-to-fit" max-width="100%">
  +        <xsl:if test="@height">
  +          <xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
  +        </xsl:if>
  +        <xsl:if test="@width">
  +          <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
  +        </xsl:if>
  +      </fo:external-graphic>
  +      <!-- alt text -->
  +      <xsl:if test="normalize-space(@alt)!=''">
  +          <fo:block><xsl:value-of select="@alt"/></fo:block>
  +      </xsl:if>
  +    </fo:block>
     </xsl:template>
   
     <xsl:template match="table">
  
  
  
  1.2       +14 -15    xml-forrest/src/resources/skins/common/xslt/fo/pdfoutline.xsl
  
  Index: pdfoutline.xsl
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/skins/common/xslt/fo/pdfoutline.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- pdfoutline.xsl	3 Dec 2002 00:23:19 -0000	1.1
  +++ pdfoutline.xsl	4 Dec 2002 14:14:29 -0000	1.2
  @@ -1,26 +1,25 @@
   <?xml version="1.0" encoding="UTF-8"?>
  -<!DOCTYPE xsl:stylesheet [
  -<!ENTITY copy "&#169;">
  -<!ENTITY nbsp "&#160;">
  -<!ENTITY degr "&#186;">
  -<!ENTITY sup2 "&#178;">
  -<!ENTITY sup3 "&#179;">]>
  -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http://xml.apache.org/fop/extensions" xmlns:documentation="http://sealcorp.com.au/documentation">
  +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  +                xmlns:fo="http://www.w3.org/1999/XSL/Format"
  +                xmlns:fox="http://xml.apache.org/fop/extensions"
  +                version="1.0">
   
   <xsl:template match="document" mode="outline">
  -  <fox:outline internal-destination="{generate-id()}">
  -    <fox:label>
  -      <xsl:value-of select="header/title"/>
  -      <xsl:text> - </xsl:text>
  -      <xsl:value-of select="header/authors/person/@name"/>
  -    </fox:label>
  -    <xsl:apply-templates select="body/section" mode="outline"/>
  -  </fox:outline>
  +  <fox:bookmarks>
  +    <fox:outline internal-destination="{generate-id()}">
  +      <fox:label>
  +        <xsl:value-of select="header/title"/>
  +      </fox:label>
  +      <xsl:apply-templates select="body/section" mode="outline"/>
  +    </fox:outline>
  +  </fox:bookmarks>
   </xsl:template>
   
   <xsl:template match="section" mode="outline">
     <fox:outline internal-destination="{generate-id()}">
       <fox:label>
  +      <xsl:number format="1.1.1.1.1.1.1" count="section" level="multiple"/>
  +      <xsl:text> </xsl:text>
         <xsl:value-of select="title"/>
       </fox:label>
       <xsl:apply-templates select="section" mode="outline"/>
  
  
  

Mime
View raw message