Edited 2.0/admin/Upgrading-Evergreen-2.0.xml via GitHub
[working/Evergreen.git] / style_guide / pi.xml
1 <?xml version="1.0" encoding="utf-8"?>\r
2 <chapter xml:id="style-pi" xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="EN"\r
3     xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink">\r
4     <info>\r
5         <title>Processing instructions</title>\r
6     </info>\r
7 \r
8     <para>Processing instructions (PIs) are written into the xml when the desired output cannot be\r
9         achieved with DocBook elements and attributes alone. PIs may also be used to force special\r
10         formatting in only part of a document. For a more technical introduction see Bob Stayton's\r
11             <link xlink:href="http://www.sagehill.net/docbookxsl/ProcessingInstructions.html"\r
12             xlink:title="http://www.sagehill.net/docbookxsl/ProcessingInstructions.html">DocBook\r
13             XSL: The Complete Guide</link>. There are also lists of DocBook-specific processing\r
14         instructions for <link\r
15             xlink:href="http://docbook.sourceforge.net/release/xsl/current/doc/pi/pi-html.html"\r
16             xlink:title="http://docbook.sourceforge.net/release/xsl/current/doc/pi/pi-html.html"\r
17             >html</link> and <link\r
18             xlink:href="http://docbook.sourceforge.net/release/xsl/current/doc/pi/pi-fo.html"\r
19             xlink:title="http://docbook.sourceforge.net/release/xsl/current/doc/pi/pi-fo.html"\r
20             >pdf</link> output.</para>\r
21 \r
22     <para>PIs should be used sparingly: it is easier to maintain documents that achieve the desired\r
23         output with DocBook elements and <link\r
24             xlink:href="http://docbook.sourceforge.net/release/xsl/current/doc/html/index.html"\r
25             xlink:title="http://docbook.sourceforge.net/release/xsl/current/doc/html/index.html"\r
26             >stylesheet parameters</link>. However, there are a few cases where PIs may be\r
27         necessary:</para>\r
28 \r
29     <itemizedlist>\r
30         <listitem>\r
31             <formalpara>\r
32                 <title>Force line break</title>\r
33                 <para>Line breaks should not be used for spacing between elements; this is much\r
34                     better done with CSS and XSL. Hoever, if entering multiple lines that must be\r
35                     displayed in succession but without the separation of a new paragraph, you may\r
36                     use the linebreak PI.  The following code</para>\r
37             </formalpara>\r
38             <programlisting>\r
39   <![CDATA[<para>First line <?linebreak?>Second line <?linebreak?>Third line</para>]]>                  \r
40             </programlisting>\r
41             <para>Will output</para>\r
42             <informalexample><para>First line <?linebreak?>Second line <?linebreak?>Third line</para></informalexample>\r
43 \r
44             <caution><para>This only works if\r
45                 custom stylesheets include the following code, described in <link\r
46                     xlink:href="http://www.sagehill.net/docbookxsl/LineBreaks.html"\r
47                     xlink:title="http://www.sagehill.net/docbookxsl/LineBreaks.html">Bob Stayton's\r
48                     DocBook XSL</link>.  Sitka's customization layer includes this template as of June\r
49                 30, 2010:</para>\r
50             <para>\r
51   <![CDATA[<xsl:template match="processing-instruction('linebreak')">\r
52          <fo:block/>\r
53   </xsl:template>]]>                   \r
54             </para></caution>\r
55         </listitem>\r
56         \r
57         <listitem>\r
58             <formalpara><title>Include external content</title><para>To insert external content into the html output use the <emphasis>dbhtml-include</emphasis> processing instruction as described in <link xlink:href="http://www.sagehill.net/docbookxsl/InsertExtHtml.html#CodeInPage" xlink:title="http://www.sagehill.net/docbookxsl/InsertExtHtml.html#CodeInPage">DocBook XSL</link>.\r
59             This could be used to add a custom search box to the title page, an animated tutorial in the relevant section, or any other content in valid xhtml.</para></formalpara>\r
60         </listitem>\r
61         \r
62     </itemizedlist>\r
63 </chapter>\r