InDesign

Tag items

Before you export content to an XML file, you must tag the text and other items (such as frames and tables) that you want to export. You also need to tag items that you have created as placeholders for imported XML content. Items that have been tagged appear as elements in the Structure pane.

Create (or load) tags to identify each content element that you want to export or import. Then tag text or page items using one of these techniques:

Manual tagging
Select a frame or text and then click a tag in the Tags panel, or simply drag a tag from the Tags panel to a text or graphics frame.

Automatic tagging
Select a text frame, table, table cells, or image, and then click the Autotag icon in the Tags panel. Items are tagged according to your tagging preset options.

Map tags to styles
Associate tags with paragraph, character, table, or cell styles, and then apply tags automatically to text, a table, table cells, and paragraphs that were assigned those styles.

When tagging page items, note the following:

  • You can apply tags to stories as well as to text within stories. For example, you might want to apply an Article tag to a story, and then apply more specific tags, such as Title and Body, to paragraphs within the story.

  • You can apply only one tag to a story. When you tag a frame in a threaded story, all other frames in the story, along with any overset text, are assigned the same tag.

  • You can apply only one tag to a graphics frame. When you tag a graphics frame, InDesign records a reference to the graphic’s location (on disk).

  • You cannot tag a group of objects. To tag an item that’s part of a group, use the Direct Selection tool  to select the item.

  • When you tag text within a tagged element (such as a paragraph within a story), it appears as a child of the existing element in the Structure pane.

  • You can tag text or images on a master page, but only one instance of the corresponding element appears in the Structure pane regardless of how many times the item appears on document pages. However, if you manually override a master item and then tag it on a document page, the item will appear as a separate element in the Structure pane.

  • You can’t tag a footnote.

Note: Avoid tagging special characters, such as the Automatic Page Number character. When exporting, InDesign strips out some special characters to comply with XML standards. InDesign warns you when characters cannot be encoded in XML.

Tag frames manually

You can tag frames by using any of these methods.

  • Drag a tag from the Tags panel onto a frame.
  • Using a selection tool, select a frame, and then click a tag in the Tags panel.
    If a frame is part of a group or nested within another frame, use the Direct Selection tool to select the frame.
  • Open a frame’s context menu, choose Tag Frame, and then choose a tag.
  • Using a selection tool, select an untagged text or graphics frame, drag the frame to the Structure pane, release the mouse, and then select a tag name from the menu that appears.

Tag text within a text frame manually

When you tag text within a frame, the new element appears in the Structure pane as a child of the frame element in which the text is located.

  1. Make sure that the story in which the text appears is tagged. (If a story isn’t tagged and you tag text within the story, InDesign automatically tags the story using the tag specified in the Tagging Preset Options dialog box.)
  2. Using the Type tool, select text within the text frame.
  3. Click a tag in the Tags panel.
Note: You can’t tag footnotes.

Tag text frames, tables, table cells, and images automatically

By clicking the Autotag icon in the Tags panel, you can tag a text frame, table, table cells, or an image automatically. To tag the item, InDesign applies a default tag that you specify in the Tagging Preset Options dialog box.

  1. Select the text frame, table, table cells, or image that you want to tag.
  2. In the Tags panel, click the Autotag icon .

    InDesign adds the default tag’s name to the Tags panel after you click the Autotag icon.

Tag content according to paragraph or character style

Paragraph styles and character styles you assign to text can be used as a means of tagging paragraphs and text for XML. For example, a paragraph style called Caption can be associated with a tag called FigureName. Then, using the Map Styles To Tags command, you can apply the FigureName tag to all text in your document assigned the Caption paragraph style. You can map more than one style to the same tag.

Important: The Map Styles To Tags command tags content automatically, including paragraphs and characters that are tagged already. For example, if a paragraph assigned the Context style has been tagged with the Body tag, but you then associate the Context style with the Expository tag, the paragraph is retagged; it is stripped of the Body tag and given the Expository tag instead. If you want to retain existing tags, apply tags manually (or use the Map Styles To Tags command very carefully).
  1. Choose Map Styles To Tags from the Tags panel menu.
  2. For each style in your document, specify the tag that you want it to be mapped to.
    Map Styles To Tags dialog box

  3. To match style names to tag names, click Map By Name. Styles that are named identically to tag names are selected in the dialog box. Map By Name is case-sensitive; Head1 and head1, for example, are treated as different tags.
  4. To use style mappings set up in another InDesign file, click Load and select the file.
  5. Select or deselect Include options:
    Master Page Items
    Maps styles found on master page text frames to tags.

    Pasteboard Items
    Maps styles found on text frames on the pasteboard to tags. (Deselect this option to avoid tagging content on the pasteboard.)

    Empty Frames
    Maps styles located on empty text frames to tags. (Deselect this option to avoid tagging empty frames.)

  6. Click OK.

The new XML tags are applied throughout your document to paragraph and character styles that you specified in the Map Styles To Tags dialog box.

Note: You cannot tag images with the Map Styles To Tags command. You need to manually tag images if you want to include them in an XML file.

Tag text in tables

When you tag a table for XML, you create a table element as well as one cell element for each cell in the table. The cell elements are child elements of the table element, and are created automatically.

  1. Click in the table and choose Table > Select > Table.
  2. Select a tag for the table in the Tags panel.

    InDesign creates a cell element for each cell in the table (you can display them in the Structure pane). The tag applied to table cell elements depends on your Autotag default settings.

  3. If needed, tag table cells with a different tag.

    For example, you can tag the first-row cells with a different tag to identify them as heading cells. To apply tags to cells, select the actual table cells in your document, and then select a tag. (Selecting cells in the table also selects the corresponding cell elements in the Structure pane.)

You can also tag a table by selecting it and then clicking the Autotag icon in the Tags panel. The Table tag (or another tag of your choice) is applied immediately to the table, according to your Autotag default settings.