1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5<title>Bringing Together a BoostBook Document</title> 6<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css"> 7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 8<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> 9<link rel="up" href="../boostbook.html" title="Chapter 49. The BoostBook Documentation Format"> 10<link rel="prev" href="documenting.html" title="Documenting libraries"> 11<link rel="next" href="../reference.html" title="Reference"> 12</head> 13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 14<table cellpadding="2" width="100%"><tr> 15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td> 16<td align="center"><a href="../../../index.html">Home</a></td> 17<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td> 18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 20<td align="center"><a href="../../../more/index.htm">More</a></td> 21</tr></table> 22<hr> 23<div class="spirit-nav"> 24<a accesskey="p" href="documenting.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boostbook.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../doc/src/images/next.png" alt="Next"></a> 25</div> 26<div class="section"> 27<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 28<a name="boostbook.together"></a>Bringing Together a BoostBook Document</h2></div></div></div> 29<div class="toc"><dl class="toc"><dt><span class="section"><a href="together.html#boostbook.linking">Linking in BoostBook</a></span></dt></dl></div> 30<div class="section"> 31<div class="titlepage"><div><div><h3 class="title"> 32<a name="boostbook.linking"></a>Linking in BoostBook</h3></div></div></div> 33<p>How one links to another element in BoostBook depends 34 greatly on the nature of the element linked and how the link 35 should appear. There are three general linking elements: 36 <xref>, <link>, and <ulink>. Additionally, there 37 are linking elements for referencing specific types of entities, 38 such as classes (<classname>), functions 39 (<functionname>), or libraries (<libraryname>).</p> 40<p>The <xref> element references elements that have an 41 <code class="computeroutput">id</code> attribute and a title. The actual link text is 42 composed from title and type of the element referenced. To link to 43 a particular ID, create an <xref> element with the 44 <code class="computeroutput">linkend</code> attribute set to the ID of the intended 45 target. For instance, this section's ID is 46 <code class="computeroutput">boostbook.linking</code>, so we create a reference it to 47 with <code class="computeroutput"><xref linkend="boostbook.linking"/></code>, which 48 will look like this in the text: <a class="xref" href="together.html#boostbook.linking" title="Linking in BoostBook">the section called “Linking in BoostBook”</a>.</p> 49<p>The <link> element references an ID in the same way as 50 <xref>, except that <link> does not generate any text 51 for the link, so text must be supplied within the element. For 52 instance, we can again link to this chapter but this time specify 53 our own text with <code class="computeroutput"><link 54 linkend="boostbook.linking">like this</link></code>. This 55 markup will result in a link to this chapter that looks <a class="link" href="together.html#boostbook.linking" title="Linking in BoostBook">like this</a>.</p> 56<p>The <ulink> element references a URL that is outside 57 of the DocBook document. The <code class="computeroutput">url</code> attribute contains 58 the URL to link to, and the element data provides the link 59 text.For instance, we can link to the the Boost web site with 60 <code class="computeroutput"><ulink 61 url="http://www.boost.org">Boost</ulink>,</code> which 62 appears in the document like this: <a href="http://www.boost.org" target="_top">Boost</a>.</p> 63<p>In BoostBook, <ulink> supports a custom url schema for 64 linking to files within the boost distribution. This is formed by 65 setting the <code class="computeroutput">url</code> attribute to <code class="computeroutput">boost:</code> 66 followed by the file's path. For example, we can link to the 67 flyweight library with 68 <code class="computeroutput"><ulink 69 url="boost:/libs/flyweight/index.html">Boost.Flyweight</ulink></code>, 70 which will appear like this: <a href="../../../libs/flyweight/index.html" target="_top">Boost.Flyweight</a>. 71 This schema is only supported for BoostBook <ulink> elements. 72 It isn't available for any other elements or in Docbook.</p> 73<p>The <classname>, <functionname>, 74 <methodname>, and <libraryname> link to classes, 75 functions, methods, and libraries, respectively. The text of each 76 element gives both the name of the element to link to and the link 77 text. For instance, we can link to the Function library with 78 <code class="computeroutput"><libraryname>Function</libraryname></code>, 79 which results in the following: 80 <a class="link" href="../function.html" title="Chapter 16. Boost.Function">Function</a>. In cases where the displayed 81 text is different from the actual name, the <code class="computeroutput">alt</code> 82 attribute can be specified. For instance, the following XML 83 element references the <code class="computeroutput"><a class="link" href="../boost/function.html" title="Class template function">boost::function</a></code> 84 class template but displays the text <code class="computeroutput"><a class="link" href="../boost/function.html" title="Class template function">function</a></code>: <code class="computeroutput"><classname 85 alt="boost::function">function</classname></code>.</p> 86</div> 87</div> 88<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 89<td align="left"></td> 90<td align="right"><div class="copyright-footer">Copyright © 2003-2005 Douglas Gregor<p>Distributed under the Boost Software License, Version 1.0. 91 (See accompanying file LICENSE_1_0.txt or copy at 92 <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>). 93 </p> 94</div></td> 95</tr></table> 96<hr> 97<div class="spirit-nav"> 98<a accesskey="p" href="documenting.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boostbook.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../doc/src/images/next.png" alt="Next"></a> 99</div> 100</body> 101</html> 102