Viewing Undefined Styles

You can view a list of all files where you have style classes applied to content, but those styles have not been defined. This might occur, for example, if you have created a new style class and applied it to a paragraph in a topic. Later, you remove that style class from the stylesheet. Therefore, you now have a style in a topic that is no longer defined in the stylesheet. You need to either apply a different, existing style class to that content, or you need to add the style class to the stylesheet again. You can also quickly rename or remove multiple style occurrences in a single batch, add the undefined style to the project, or map the undefined style to an existing style.

How to View Undefined Styles

  1. Open a project.
  2. Do one of the following, depending on the part of the user interface you are using:

    • Ribbon Select Analysis > Undefined Items > Undefined Styles.

    • Analysis Summary Window Pane Double-click the row that mentions undefined styles.

    The Undefined Styles window pane opens.

  3. To see more of the information in the window pane, drag the divider bar to make the pane wider.
    • Tag Displays the parent tag for the class.
    • Style Displays the child style class that is applied to content in the file.
    • File Displays the name of the file.
    • Title Displays the properties title of the file (if any).
    • Folder Displays the folder where the file is found.
  4. If a certain number of items have been found, page navigation buttons in the local toolbar may be enabled. You can use these buttons to go to additional pages to display more items. You can also click View All in the local toolbar to see all results on a single page. Keep in mind that the more items you have in the project, the longer it will take to load this view.

How to Fix Undefined Styles

There are a few basic ways to fix an undefined style: (1) You can rename the style; (2) you can remove the style from the content; (3) you can apply a different style class to the affected content; (4) you can add a new style to the stylesheet; and (5) you can map the undefined style to an existing style.

To Rename Style Classes

  1. In the window pane, select all style class occurrences that you want to rename. If you want to select all rows click Click to select all rows.. You can hold the SHIFT key to select a range, or you can hold the CTRL key to select individual items.

    Note All style class occurrences that you select will be renamed to the same style that you provide in the following steps.

  2. In the local toolbar, click the Rename button. The Rename Style(s) dialog opens.
  3. In the New style name field, enter a new style class.
  4. Click OK.
  5. A message lets you know how many files were changed. Click OK. All of the selected style class occurrences are renamed.

    Note If you want to undo the conversions, you can use the Backups window pane (View > Backups). See Restoring Backup Files.

To Remove Style Classes

  1. In the window pane, select all style class occurrences that you want to delete. If you want to select all rows click Click to select all rows.. You can hold the SHIFT key to select a range, or you can hold the CTRL key to select individual items.
  2. In the local toolbar, click Use delete to empty contents..
  3. Click OK.
  4. A message lets you know how many files were changed. Click OK. All of the selected style class occurrences are removed.

    Note If you want to undo the conversions, you can use the Backups window pane (View > Backups). See Restoring Backup Files.

To Apply Different Style Classes

  1. You can either double-click on the specific row, or right-click on the row and select Open.

  2. Select Home, click the down arrow in the field displaying styles, and choose a new style class. See Styles and Stylesheets for more information about styles and how to apply them.
  3. Click Save the active file. to save your work.

To Add a Style

  1. In the window pane, select the style that you want to add to the project.

  2. Do one of the following, depending on the part of the user interface you are using:

    • Local Toolbar Click Select a style that you want to add to a project..
    • Right-Click Right-click on the condition tag you want to add and from the context menu select Add New Style.

    The Create Style dialog opens.

  3. On the left side of the dialog, select one of the following:
    • Class Select this if you want to create a simple class (e.g., a special paragraph intended to serve as a tip or note).
    • ID In CSS, an identifier (ID) is similar to a class, except that IDs are unique. An element in your stylesheet can have only one ID on it, whereas it can have multiple classes. And each page of your output can have only one element with a particular ID. For many authors, using an ID may not be important, but for others—such as those making use of JavaScript—IDs can be very useful.
  4. In the field after your selection, type a name for the new style class or ID, without using spaces.
  5. On the right side of the dialog, select the stylesheet to which you want to add the new style.
  6. The property values already applied to the selected content are shown. If you do not want to include certain property values in the new selector, click the check box next to the value (in the Include column) to remove the check mark.
  7. If you want the new style to immediately be applied to the content selected in the topic, select Create style and update the source element. If you do not want the new style to immediately be applied to the content selected in the topic, select Create style without updating the source element.
  8. Click OK. The style is added to the currently linked stylesheet.
  9. Click Save the active file. to save your work.

To Map to a Style

  1. In the window pane, select the style that you want to map to an existing style.

  2. Do one of the following, depending on the part of the user interface you are using:

    • Local Toolbar Click Click to select a style to map to an existing style..
    • Right-Click Right-click on the condition tag you want to add and from the context menu select Map to Existing Style.

    The Select Class or ID dialog opens.

  3. In the dialog, select the existing style class or ID in the project to overwrite the current undefined style.
  4. Click OK. All of the selected style occurrences are overwritten with the new style.

  5. Click Save the active file. to save your work.

What’s Noteworthy?

Note You can also include this information in reports that you create. See Reports.

Note If you've imported topics that use embedded styles, they might display in the Undefined Styles window pane. Therefore, you should enable the collection of embedded stylesheet prospects on the Project Analysis tab of the Options dialog (File > Options). See Enabling Analysis Scans.