和荣笔记 - XSL-FO 与 XHTML
杨和荣, 版本 2.03, 2007年

中文网页和排版

Part:   1  2  3  4  5 

(Continued from previous part...)

<fo:root>
 <fo:layout-master-set>
  <fo:simple-page-master master-name="page" 
   margin-left="1.2in" margin-right="0.8in"
   margin-top="0.8in" margin-bottom="0.8in">
   <fo:region-before region-name="header" extent="0.25in"
    background-color="#ffffff"/>
   <fo:region-after region-name="footer" extent="0.4in"
    background-color="#ffffff"/>
   <fo:region-body region-name="body" 
    margin-top="0.35in" margin-bottom="0.5in"/>
  </fo:simple-page-master>
 <xsl:if test="$filename='toc.html'">
  <fo:simple-page-master master-name="cover" 
   margin-left="1.2in" margin-right="0.8in"
   margin-top="0.8in" margin-bottom="0.8in">
   <fo:region-body region-name="body"/>
  </fo:simple-page-master>
 </xsl:if>
 </fo:layout-master-set>
 
<xsl:if test="$filename='toc.html'">
 <fo:page-sequence master-reference="cover">
  <fo:flow flow-name="body">
    <fo:block font-family="SimHei" font-size="22pt" font-weight="bold"
     space-before="2in" space-after="0.2in" text-align="center">
     <xsl:value-of select="$title"/>
    </fo:block>
    <fo:block font-family="SimHei" font-size="12pt" font-weight="bold"
     space-before="0.2in" space-after="0.2in" text-align="center">
     <xsl:value-of select="$version"/>
    </fo:block>
    <fo:block font-family="SimHei" font-size="16pt" font-weight="bold"
     space-before="2in" space-after="2in" text-align="center">
     <xsl:value-of select="$author"/>
    </fo:block>
    <fo:block font-family="SimHei" font-size="12pt" font-weight="bold"
     space-before="0.5in" space-after="2in" text-align="center">
     <xsl:value-of select="$copyright"/>
    </fo:block>
  </fo:flow>
 </fo:page-sequence>
</xsl:if>
 
 <fo:page-sequence master-reference="page">
  <fo:static-content flow-name="header"
   font-family="SimHei" font-size="12pt" font-style="normal">
   <fo:block border-bottom-width="1px" border-bottom-style="solid">
    <fo:list-block>
     <fo:list-item>
      <fo:list-item-label>
       <fo:block font-weight="normal" text-align="start">
        <xsl:value-of select="$pagetitle"/>
       </fo:block>
      </fo:list-item-label>
      <fo:list-item-body>
       <fo:block font-weight="normal" text-align="end">
        <fo:page-number/>
       </fo:block>
      </fo:list-item-body>
     </fo:list-item>
    </fo:list-block>
   </fo:block>
  </fo:static-content>

  <fo:static-content flow-name="footer"
   font-family="SimHei" font-size="10pt" font-style="normal">
   <fo:block border-top-width="1px" border-top-style="solid"
    text-align="start">
    <fo:list-block>
     <fo:list-item>
      <fo:list-item-label>
       <fo:block font-weight="bold" text-align="start">
        <xsl:value-of select="$title"/>
       </fo:block>
      </fo:list-item-label>
      <fo:list-item-body>
       <fo:block font-weight="normal" text-align="end">
        <xsl:value-of select="$author"/>
       </fo:block>
      </fo:list-item-body>
     </fo:list-item>
     <fo:list-item>
      <fo:list-item-label>
       <fo:block font-weight="normal" text-align="start">
        <xsl:value-of select="$version"/>,
        updated on <xsl:value-of select="$date"/>
       </fo:block>
      </fo:list-item-label>
      <fo:list-item-body>
       <fo:block font-weight="normal" text-align="end">
       </fo:block>
      </fo:list-item-body>
     </fo:list-item>
    </fo:list-block>
   </fo:block>
  </fo:static-content>

  <fo:flow flow-name="body"
   font-family="SimHei" font-size="12pt" font-style="normal">
  <xsl:apply-templates select="body"/>
  </fo:flow>
 </fo:page-sequence>
</fo:root>
 </xsl:template>

 <xsl:template match="body">
  <xsl:apply-templates select="//p/ul|//p|//ul|//pre"/>
 </xsl:template>

 <xsl:template match="p[@class='chapter_title']">
   <fo:block id="{@id}" font-size="150%" font-weight="bold"
    space-before="12pt" space-after="4pt">
  <xsl:apply-templates select="text()"/>
   </fo:block>
 </xsl:template>

(Continued on next part...)

Part:   1  2  3  4  5 

杨和荣,修改于2007年
和荣笔记 - XSL-FO 与 XHTML - 中文网页和排版