<html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>make.index.markup</title><link rel="stylesheet" href="../ref.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.0"><link rel="home" href="index.html" title="FO Parameter Reference"><link rel="up" href="rn03.html" title="ToC/LoT/Index Generation"><link rel="previous" href="generate.index.html" title="generate.index"><link rel="next" href="toc.section.depth.html" title="toc.section.depth"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">make.index.markup</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="generate.index.html">Prev</a> </td><th width="60%" align="center">ToC/LoT/Index Generation</th><td width="20%" align="right"> <a accesskey="n" href="toc.section.depth.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="make.index.markup"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>Name</h2><p>make.index.markup — Generate XML index markup in the index?</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><a name="make.index.markup.frag"></a><table border="1" width="100%"><tr><td><p><b>§21</b>: <a href="#top">§199</a></p></td></tr><tr><td><pre class="src:fragment"> 1| <xsl:param name="make.index.markup" 2| select="0"/></pre></td></tr></table></div><div class="refsect1" lang="en"><h2>Description</h2><p>This parameter enables a very neat trick for getting properly merged, collated back-of-the-book indexes. G. Ken Holman suggested this trick at Extreme Markup Languages 2002 and I'm indebted to him for it.</p><p>Jeni Tennison's excellent code in <tt class="filename">autoidx.xsl</tt> does a great job of merging and sorting <a href="http://docbook.org/tdg/en/html/indexterm.html"><tt class="sgmltag-element">indexterm</tt></a>s in the document and building a back-of-the-book index. However, there's one thing that it cannot reasonably be expected to do: merge page numbers into ranges. (I would not have thought that it could collate and suppress duplicate page numbers, but in fact it appears to manage that task somehow.)</p><p>Ken's trick is to produce a document in which the index at the back of the book is “<span class="quote">displayed</span>” in XML. Because the index is generated by the FO processor, all of the page numbers have been resolved. It's a bit hard to explain, but what it boils down to is that instead of having an index at the back of the book that looks like this:</p><div class="blockquote"><blockquote class="blockquote"><p><b>A. </b>ap1, 1, 2, 3</p></blockquote></div><p>you get one that looks like this:</p><div class="blockquote"><blockquote class="blockquote"><pre class="programlisting"><indexdiv>A</indexdiv> <indexentry> <primaryie>ap1</primaryie>, <phrase role="pageno">1</phrase>, <phrase role="pageno">2</phrase>, <phrase role="pageno">3</phrase> </indexentry></pre></blockquote></div><p>After building a PDF file with this sort of odd-looking index, you can extract the text from the PDF file and the result is a proper index expressed in XML.</p><p>Now you have data that's amenable to processing and a simple Perl script (such as <tt class="filename">fo/pdf2index</tt>) can merge page ranges and generate a proper index.</p><p>Finally, reformat your original document using this literal index instead of an automatically generated one and “<span class="quote">bingo</span>”!</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="generate.index.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="rn03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="toc.section.depth.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">generate.index </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> toc.section.depth</td></tr></table></div></body></html>