Edit online

Additional CSS Selectors

Oxygen XML Editor provides support for selecting additional types of nodes. These custom selectors apply to: document, doctype, processing-instruction, comment, CDATA sections, entities, and reference sections. Processing-instructions are not displayed by default. To display them, open the Preferences dialog box (Options > Preferences), go to Editor > Author, and select Show processing instructions.

Note:
The custom selectors are presented in the default CSS for Author mode and all of their properties are marked with the !important flag. For this reason, you have to set the !important flag on each property of the custom selectors from your CSS to be applicable.

For the custom selectors to work in your CSS stylesheets, declare the Author mode extensions namespace at the beginning of the stylesheet documents:

@namespace oxy url('http://www.oxygenxml.com/extensions/author');
  • oxy|document - The oxy|document selector matches the entire document:
    oxy|document {
        display:block !important;
    }
  • oxy|doctype - The following example changes the rendering of doctype sections:
    oxy|doctype {
        display:block !important;
        color:blue !important;
        background-color:transparent !important;
    }
  • oxy|processing-instruction - To match the processing instructions, you can use the oxy|processing-instruction selector:
    oxy|processing-instruction {
        display:block !important;
        color:purple !important;
        background-color:transparent !important;
    }
    A processing instruction usually has a target and one or more pseudo attributes:
    <?target_name data="b"?>
    You can match a processing instruction with a particular target from the CSS using the following construct:
    oxy|processing-instruction[target_name]
    You can also match the processing instructions having a certain target and pseudo attribute value, such as:
    oxy|processing-instruction[target_name][data="b"]
  • oxy|comment - The XML comments displayed in Author mode can be changed using the oxy|comment selector:
    oxy|comment {
        display:block !important;
        color:green !important;
        background-color:transparent !important;
    }
  • oxy|cdata - The oxy|cdata selector matches CDATA sections:
    oxy|cdata{
        display:block !important;
        color:gray !important;
        background-color:transparent !important;
    } 
  • oxy|entity - The oxy|entity selector matches the entity content:
    oxy|entity {
        display:morph !important;
        editable:false !important;
        color:orange !important;
        background-color:transparent !important;
    }
    To match particular entities, use the oxy|entity selector in expressions such as:
    oxy|entity[name='amp'],
    oxy|entity[name='lt'],
    oxy|entity[name='gt'],
    oxy|entity[name='quot'],
    oxy|entity[name='apos'],
    oxy|entity[name^='#']{
        -oxy-display-tags: none;
    }
  • oxy|reference - The references to entities, XInclude, and DITA @conref and @conkeyref attributes are expanded by default in Author mode and the referenced content is displayed. The referenced resources are displayed inside the element or entity that references them.

    You can use the reference property to customize the way these references are rendered in Author mode:
    oxy|reference {
      border:1px solid gray !important;
    }

    In the Author mode, content is highlighted when text contains comments and changes (if Track Changes was active when the content was modified).

    If this content is referenced, the Author mode does not display the highlighted areas in the new context. If you want to mark the existence of the comments and changes, you can use the oxy|reference[comments], oxy|reference[changeTracking], and oxy|reference[changeTracking][comments] selectors.
    Note:
    Two artificial attributes (comments and changeTracking) are set on the reference node, containing information about the number of comments and tracked changes in the content.
    • The following example represents the customization of the reference fragments that contain comments:
      oxy|reference[comments]:before {
        content: "Comments: " attr(comments) !important;  
      }
    • To match reference fragments based on the fact that they contain tracked changes inside, use the oxy|reference[changeTracking] selector:
      oxy|reference[changeTracking]:before {
        content: "Change tracking: " attr(changeTracking) !important;  
      }
    • Here is an example of how you can set a custom color for the reference containing both tracked changes and comments:
      oxy|reference[changeTracking][comments]:before {
        content: "Change tracking: " attr(changeTracking) 
                 " and comments: " attr(comments) !important;  
      }
Figure 1. Example: A Document Rendered Using these Rules