Elementname: Makeindex

Description

Sort and split a list of elements to make an index.

Allowed attributes: pagenumber, section, select, sortkey

Child elements: (none)

Parent elements: Element, SaveDataset

Attributes

pagenumber (text, optional, since version 2.7.11)

The name of the attribute that holds the page numbers. Defaults to 'page'.

section (text)

Create an XML-element with this name for every section (letter) in the index.

select (XPath Expression)

The xpath expression ($variable) that holds the element structure for the index.

sortkey (text)

The name of the attribute holding the indexentry (that should be sorted).

Example

Index generation works in two steps: First, collect all the entries in a Element structure, then, while saving the generated structure, sort the keys and group them with this command.

  <Record element="data">
    <LoadDataset name="index" />
    <SetVariable variable="indexentries">
      <Element name="indexentry">
        <Attribute name="name" select="'Home'" />
        <Attribute name="page" select="1" />
      </Element>
      <Element name="indexentry">
        <Attribute name="name" select="'House'" />
        <Attribute name="page" select="2" />
      </Element>
      <Element name="indexentry">
        <Attribute name="name" select="'Hello'" />
        <Attribute name="page" select="3" />
      </Element>
      <Element name="indexentry">
        <Attribute name="name" select="'Garage'" />
        <Attribute name="page" select="4" />
      </Element>
    </SetVariable>
    <SaveDataset filename="index" elementname="Index">
      <Makeindex select="$indexentries" sortkey="name" section="part" />
    </SaveDataset>
  </Record>

  <Record element="Index">
    <ForAll select="part">
      <PlaceObject>
        <Table width="3" stretch="max">
          <Tr>
            <Td border-bottom="0.4pt" colspan="2">
              <Paragraph><Value select="@name" /></Paragraph>
            </Td>
          </Tr>
          <ForAll select="indexentry">
            <Tr>
              <Td>
                <Paragraph><Value select="@name" /></Paragraph>
              </Td>
              <Td>
                <Paragraph><Value select="@page" /></Paragraph>
              </Td>
            </Tr>
          </ForAll>
        </Table>
      </PlaceObject>
    </ForAll>
  </Record>

See also

SaveDataset

Commands

Version: 3.5.9 | Start page | Command reference | Other language: German