Creating Footnotes: fo:footnote and fo:footnote-body

Creating Footnotes: <fo:footnote> and <fo:footnote-body>

Footnotes are called out-of-line formatting objects because they add text at the bottom of the page. You create a footnote with the <fo:footnote> element, and the body text of the footnote with <fo:footnote-body> . Neither of these elements supports any properties in the current XSL-FO specification.

The following example, footnotes.fo, puts footnotes to work; in this case, I use two footnotes in the body of the document and add the text for those footnotes:

Listing 12.5 footnotes.fo
 <?xml version="1.0" encoding="UTF-8"?>  <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">      <fo:layout-master-set>          <fo:simple-page-master margin-right="20mm" margin-left="20mm"              margin-bottom="10mm" margin-top="10mm" page-width="300mm"              page-height="400mm" master-name="page">              <fo:region-body margin-right="0mm" margin-left="0mm"                  margin-bottom="10mm" margin-top="0mm"/>              <fo:region-after extent="10mm"/>          </fo:simple-page-master>      </fo:layout-master-set>      <fo:page-sequence master-name="page">          <fo:flow flow-name="xsl-region-body">              <fo:block space-after="12pt" font-weight="bold"                  font-size="36pt" text-align="center">                  Using Footnotes              </fo:block>              <fo:block font-size="24pt">                  This                  <fo:footnote>                      <fo:inline>footnote                          <fo:inline font-size="16pt"                          vertical-align="super">                              1                          </fo:inline>                      </fo:inline>                      <fo:footnote-body>                          <fo:block>                              1. Here's the first footnote's text.                          </fo:block>                      </fo:footnote-body>                  </fo:footnote>                    refers to text at the bottom of this page.              </fo:block>              <fo:block font-size="24pt">                  This second                  <fo:footnote>                      <fo:inline>footnote                          <fo:inline font-size="16pt"                          vertical-align="super">                              2                          </fo:inline>                      </fo:inline>                      <fo:footnote-body>                          <fo:block>                              2. And here's the second footnote's text.                          </fo:block>                      </fo:footnote-body>                  </fo:footnote>                  also refers to text at the bottom of this page.              </fo:block>          </fo:flow>      </fo:page-sequence>  </fo:root> 

You can see text, complete with the footnote superscripts 1 and 2, in Figure 12.4.

Figure 12.4. Text with footnotes.
graphics/12fig04.gif

And you can see the text for the two footnotes at the bottom of the same page in Figure 12.5.

Figure 12.5. Footnote text at the bottom of a page.
graphics/12fig05.gif

To create footnoted text, you use the <fo:footnote> element. With the fop processor, youre responsible for adding the actual superscripted footnote number, such as 1 or 2, yourself. Heres how that looks in footnotes.fo, where I set an inline elements vertical-align property to super to create a superscript:

 <fo:block font-size="24pt">                  This                  <fo:footnote>                      <fo:inline>footnote                          <fo:inline font-size="16pt" vertical-align="super">1</fo:inline>                      </fo:inline>                      .                      .                      .              </fo:block> 

To create the footnote text that appears at the bottom of the page, you use an <fo:footnote-body> element inside the <fo:footnote> element. The fop processor does not number footnotes itself, so youre responsible for adding the footnote numbers , as follows :

 <fo:block font-size="24pt">      This      <fo:footnote>          <fo:inline>footnote              <fo:inline font-size="16pt"              vertical-align="super">                  1              </fo:inline>          </fo:inline>          <fo:footnote-body>              <fo:block>                  1. Here's the first footnote's text.              </fo:block>          </fo:footnote-body>      </fo:footnote>        refers to text at the bottom of this page.  </fo:block> 

This XSL-FO produces both the first footnoted text you see in Figure 12.4 and the first footnotes text itself you see in Figure 12.5.



Inside XSLT
Inside Xslt
ISBN: B0031W8M4K
EAN: N/A
Year: 2005
Pages: 196

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net