<html><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>make.index.markup</title><link rel="stylesheet" type="text/css" href="../reference.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.2"><link rel="home" href="../index.html" title="DocBook XSL Stylesheets: Reference Documentation"><link rel="up" href="toc_index.html" title="ToC/LoT/Index Generation"><link rel="prev" href="generate.index.html" title="generate.index"><link rel="next" href="index.method.html" title="index.method"><link rel="copyright" href="copyright.html" title="License"></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="index.method.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="make.index.markup"></a><div class="titlepage"></div><div class="refnamediv"><h2><span class="refentrytitle">make.index.markup</span></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><pre class="programlisting"> <xsl:param name="make.index.markup" select="0"></xsl:param> </pre></div><div class="refsection"><a name="d0e12181"></a><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 <code class="filename">autoidx.xsl</code> does a great job of merging and sorting <code class="sgmltag-element">indexterm</code>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">“<span class="quote">displayed</span>”</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 <code class="filename">fo/pdf2index</code>) 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">“<span class="quote">bingo</span>”</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="toc_index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="index.method.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"> index.method</td></tr></table></div></body></html>