Commit 72b5c9f7 authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

README.md

0 → 100644
+15 −0
Changes for README.md: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
## Example files for the title:  
  
# XSL-FO, by Dave Pawson
  
[![XSL-FO, by Dave Pawson](http://akamaicovers.oreilly.com/images/9780596003555/cat.gif)](https://www.safaribooksonline.com/library/view/title/0596003552//)
  
The following applies to example files from material published by O’Reilly Media, Inc. Content from other publishers may include different rules of usage. Please refer to any additional usage rights explained in the actual example files or refer to the publisher’s website.
  
O'Reilly books are here to help you get your job done. In general, you may use the code in O'Reilly books in your programs and documentation. You do not need to contact us for permission unless you're reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from our books does not require permission. Answering a question by citing our books and quoting example code does not require permission. On the other hand, selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Incorporating a significant amount of example code from our books into your product's documentation does require permission.
  
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN.
  
If you think your use of code examples falls outside fair use or the permission given here, feel free to contact us at <permissions@oreilly.com>.
  
Please note that the examples are not production code and have not been carefully testing. They are provided "as-is" and come with no warranty of any kind.

example_code/appa.txt

0 → 100644
+89 −0
Changes for example_code/appa.txt: 89 added lines, 0 removed lines.
Original line number Diff line number Diff line
appendix: How Do I Do That?
==================
Example: Fixed-position blocks

       <fo:block-container 
[1]       absolute-position="fixed"    
[2]              top="200mm">
  <fo:block>Yours sincerely:
    <fo:inline font-style="italic">Dave Pawson</fo:inline>
  </fo:block>
</fo:block-container>
    
    
====================================
<fo:block width="4in" start-indent="(100% - 4in) div 2">
 <xsl:apply-content/>
</fo:block>
    
    
====================================
<xsl:number count="footnote" from="chapter" format="i"/>
    
    
====================================
<fo:block text-align-last="justify">
  Left-hand text
  <fo:leader leader-pattern="space" />
  Right-hand text
</fo:block>
    
    
====================================
<fo:page-sequence initial-page-label="A">
    
    
====================================
<fo:page-number-citation ref-id="theEnd"/>
...
<fo block id="theEnd"></fo:block>
    
    
====================================
<fo:page-sequence master-name="frontmatter" format="i">
    
    
====================================
<fo:static-content
 flow-name="xsl-region-after">
 <fo:block text-align="outside">C<fo:page-number/></fo:block>
 </fo:static-content>
    
    
====================================
<fo:marker marker-class-name="rh"><xsl:value-of select="title"/> </fo:marker>
    
    
====================================
<fo:static-content flow-name="xsl-region-before">
 <fo:block font=" 10pt Helvetica">
 <fo:retrieve-marker retrieve-marker-name="rh" (Spec reference is 6.11.4)
 retrieve-boundary="page"
 retrieve-position="first-starting-within-page"/>
 </fo:block>
</fo:static-content>
    
    
====================================
<
fo:character
 character="1" 
 baseline-shift="super"
 font-family="'MS Serif'"/>
    
    
====================================
<fo:inline 
 vertical-align="sub" 
 font-size="8pt"> <xsl:apply-templates/> </fo:inline>
    
    
====================================
<fo:block
 ... other properties
keep-with-next.within-page='5'>
<xsl:apply-contents/>
</fo:block>
    
    
==================
 No newline at end of file

example_code/appf.txt

0 → 100644
+819 −0

File added.

Preview size limit exceeded, changes collapsed.

example_code/ch02.txt

0 → 100644
+236 −0
Changes for example_code/ch02.txt: 236 added lines, 0 removed lines.
Original line number Diff line number Diff line
chapter: A First Look at XSL-FO
==================
Example: A basic page specification

<?xml version="1.0" encoding="utf-8"?>
[1]<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
[2]<fo:layout-master-set>
      <fo:simple-page-master 
      page-height="11in" 
      page-width="8.5in"
[3]   master-name="only">
         <fo:region-body 
[4]   region-name="xsl-region-body"  
            margin="0.7in" />
[5]   <fo:region-before
            region-name="xsl-region-before" 
            extent="0.7in" />
         <fo:region-after 
[6]   region-name="xsl-region-after"
           extent="0.7in" />
      </fo:simple-page-master>
   </fo:layout-master-set>

[7]<fo:page-sequence master-reference="only" format="A">
      <fo:flow flow-name="xsl-region-body">
[8]      <fo:block >Some base content, containing an inline warning, 
           <fo:inline >Warning: </fo:inline>Do not touch blue paper,
           a fairly straightforward piece requiring emphasis
          <fo:inline font-weight="bold">TEXT</fo:inline>, and 
           some instructions which  require presenting in a different 
           way, such as <fo:inline font-style="italic">Now light 
           the blue paper</fo:inline>.
         </fo:block>
      </fo:flow>
   </fo:page-sequence>
</fo:root>
    
    
====================================
<element style="font-size:12pt;font-weight:bold">content</element>
    
    
====================================
<fo:element font-size="12pt"
            font-weight="bold">content</element>
    
    
====================================
Example: Minimal test file

[1]<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
[2]  <fo:layout-master-set>
      <fo:simple-page-master master-name="only">
         <fo:region-body 
[3]                      region-name="xsl-region-body"
                         margin="0.7in"  padding="6pt" />
         <fo:region-before 
                           region-name="xsl-region-before" 
                           extent="0.7in"  />
         <fo:region-after 
                          region-name="xsl-region-after" 
                          extent="0.7in" />
      </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence 
[4]                  master-reference="only">

      <fo:flow flow-name="xsl-region-body">

[5]           <fo:block>Hello World</fo:block>             
      </fo:flow>
    </fo:page-sequence>
   </fo:root>
    
    
====================================
<fo:flow flow-name="xsl-region-body">
    
    
====================================
Example: Source XML for the examples

<doc>
<section><head> Simple sectioned title </head>
<para>Some base content, containing an inline warning,
  <emphasis role="warning">Do not touch blue paper</emphasis>,
  a fairly straightforward piece requiring emphasis
  <emphasis>TEXT</emphasis>, and some instructions which
  require presenting in a different way, such as
  <instruction>Now light the blue paper</instruction>.
</para>

</section>

....

</doc>
    
    
====================================
Example: Basic stylesheet

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
[1]     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fo="http://www.w3.org/1999/XSL/Format">

   <xsl:output method="xml"/>
[2]<xsl:template match="/">
    <fo:root>
      <fo:layout-master-set>
      <fo:simple-page-master 
        master-name="only">
        <fo:region-body 
           region-name="xsl-region-body" 
           margin="0.7in" 
            />
        <fo:region-before 
           region-name="xsl-region-before" 
           extent="0.7in" 
            display-align="before" />

          <fo:region-after 
           region-name="xsl-region-after" 
           display-align="after"
           extent="0.7in" 
           />
      </fo:simple-page-master>
      </fo:layout-master-set>


      <fo:page-sequence master-reference="only">
        <fo:flow 
           flow-name="xsl-region-body">
[3]         <xsl:apply-templates />
        </fo:flow>
      </fo:page-sequence>

    </fo:root>
[4]</xsl:template>
</xsl:stylesheet>
    
    
====================================
Example: Other templates

[1]<xsl:template match="section">
[2] <fo:block  id="{generate-id}">
          <xsl:apply-templates/>
    </fo:block>
   </xsl:template>


[3]<xsl:template match="head">
    <fo:block  
      font-family="Times"
      font-size="18pt"
      font-weight="bold"
      space-before="18pt"
      space-after="12pt"
      text-align="center">
          <xsl:apply-templates/>
    </fo:block>
   </xsl:template>

[4]<xsl:template match="para">
    <fo:block  
      font-family="Times"
      font-size="12pt"
      space-before="12pt"
      space-after="12pt"
      text-align="justify">
          <xsl:apply-templates/>
    </fo:block>
   </xsl:template>

[5]<xsl:template match="emphasis[@role='warning']">
      <fo:inline 
           color="red">Warning: </fo:inline>
          <xsl:apply-templates/>
   </xsl:template>
    
    
====================================
Example: Out-of-line processing for a table of contents

<xsl:template match="/">
 <fo:root>
   <fo:page-sequence master-reference="only">
       <fo:flow flow-name="xsl-region-body">
       <!-- Produce the frontmatter here -->
         <xsl:call-template name="toc"/>
[1]     <xsl:apply-templates />
       </fo:flow>
     </fo:page-sequence>

 </fo:root>
</xsl:template>

[2]<xsl:template name="toc">
[3] <xsl:for-each select="//section">
     <fo:block text-align-last="justify"><xsl:value-of 
      select="head"/> <fo:leader 
         leader-pattern="dots"/> <fo:page-number-citation ref-id="{@id}"/>
[4]   <xsl:for-each select="section">
      <fo:block text-align-last="justify" text-indent="2em"> <xsl:value-of 
       select="head"/> <fo:leader 
           leader-pattern="dots"/> <fo:page-number-citation ref-id="{@id}" />
      </fo:block>
     </xsl:for-each>
    </fo:block>
  </xsl:for-each>
</xsl:template>
    
    
====================================
space-before.minimum="2.0pt"
space-before.optimum="3.0pt"
space-before.maximum="4.0pt"
space-before.precedence="0"
space-before.conditionality="discard"
    
    
====================================
space-before="4.0pt"
    
    
====================================
space-before.minimum="4.0pt"
space-before.optimum="4.0pt"
space-before.maximum="4.0pt"
space-before.precedence="0"
space-before.conditionality="discard"
    
    
==================
 No newline at end of file

example_code/ch03.txt

0 → 100644
+565 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading