Documentation Center

role

This topic describes the role element.

Description

Roles are used for mapping toolbar buttons and behavior in the editor. For example, when the author presses Enter, the editor will try to insert the paragraph-role element. In the case of a conflict between what is specified in the configuration roles and a schema declaration, the schema rule will be applied.

Configuration directive

Roles can be assigned to a schema declaration with the node directive:

<x:nodeConfig>
  <x:node match="p">
    <x:role>paragraph</x:role>
    <x:role>hidden-from-ui</x:role>
    ...
  </x:node>
  ... 
</x:nodeConfig>
The deprecated roleMapping directive was used in the past:
<x:roleMapping>
  <x:element name="p" role="paragraph"/>
</x:roleMapping>

Roles apply to schema declarations

A role applies to a schema declaration and not specific nodes (according to the node configuration directive). That means you can't use roles in multiple node directives in what will ultimately be the same schema declaration. For example, the following code example will not work as might be expected. In this example, all notes are hidden in the user interface, not just the notes in a list item:

<x:node match="li/p/note">
  <x:role>hidden-from-ui</x:role><!-- DOES NOT WORK AS EXPECTED -->
</x:node>
<x:node match="note">
  <x:name xml:lang="en">Note</x:name>
</x:node>

Descriptions of roles

The entire list of roles with descriptions is provided in the related topic:

  • Roles- full list

For ease of look-up, the lists are also subdivided into three categories:

  • Standard HTML mapping roles
  • Semantic roles- groups of roles such as CALs table roles
  • Editor-specific roles- these are special, non-standard roles that are useful in this editor.

Namespace

http://www.xopus.com/xmlns/config

Attributes

NameDescription and useType

use

Optional. This can only be set to prohibited, which will unset the role. This can be useful where an element can inherit roles from another element, such as in DITA.

Fixed value: prohibited

Parent element

node

Lists of Roles