Before you tag page items, create (or load) tags to identify each content type or item in your document. You can create tags from scratch or load them from another source, such as an InDesign document, InCopy document, or DTD file. Use any of the following methods to create or load XML tags for your document:
Create a tag with the New Tag command.
Load tags from an XML file or another document.
Import a DTD file.
Import tags (and content) using the Import XML command.
- Select a color for the tag if you created your tag from the Tags panel menu. (If you created your tag with the New Tag button, you can choose a color by changing the color of the tag.)
You can assign the same color to different tags. The color you select appears when you apply the tag to a frame and choose View > Structure > Show Tagged Frames, or when you apply the tag to text within a frame and choose View > Structure > Show Tag Markers. (Tag colors do not appear in exported XML files.)
InDesign automatically adds tags to the Tags panel when you load an XML file.
You cannot change the name of locked tags. InDesign automatically locks tags specified in a loaded DTD file. To change the name of these tags, you must edit the DTD file and reload it into the document.
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:
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.
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.
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.
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.
- 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.
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.
You can’t tag footnotes.
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.
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.
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).
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.
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.
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.
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.
Retag an item to replace the existing tag (you don’t need to untag it first). Use one of these techniques to retag an item:
- Using a selection tool, select a text frame, a graphics frame, or an element in the Structure pane, and then click a different tag in the Tags panel.
- To retag a story, use the Type tool to place a insertion point anywhere in the story’s text. Select Retag in the Tags panel, and then click a different tag.
- To retag a text block, use the Type tool to select the entire block of text. Select Retag in the Tags panel, and then click a different tag. (If you select Add Tag and then click a different tag, a new child element appears in the Structure pane.)
When you select a text frame, table, table cells, or an image, and then click the Autotag icon in the Tags panel, InDesign applies a default tag to the item you selected. You can specify these default tags in the Tagging Preset Options dialog box.
InDesign applies a default tag when you create an element that requires a parent element, but doesn’t yet have one. For example, if you tag text within a text frame but the frame itself isn’t tagged, InDesign assigns the frame a tag according to the Tagging Preset Options. The capability to apply default tags helps InDesign maintain correct XML structure.
Tag markers are brackets that appear on the page around text that has been tagged. Show tag markers to see where titles, headings, and other text has been tagged on a page. Tagged frames indicate where items such as text frames, tables, and images have been tagged. The color assigned to a tag in the Tags panel determines the color of tag markers and tagged frames. Tag markers and tagged frames only appear in Normal view.
To display color-coded tagged frames, choose View > Structure > Show Tagged Frames.
To hide the color-coding of tagged frames, choose View > Structure > Hide Tagged Frames.
To display color brackets around tagged text, choose View > Structure > Show Tag Markers.
To hide color brackets around tagged text, choose View > Structure > Hide Tag Markers.
To minimize the risk of accidentally deleting a tag marker, edit tagged text in Story Editor, where tag markers are more visible.
- To delete a tag from the Tags panel, drag it to the Delete icon at the bottom of the panel. If the tag has been applied to content, an alert message appears. Select another tag to replace the deleted tag and click OK.
- To delete all unused tags, choose Select All Unused Tags from the Tags panel menu, and then click the Delete icon at the bottom of the panel.
Tags that were loaded with a DTD file cannot be deleted until the DTD file is deleted.