Once you have created a style sheet and a rule for it, see the procedures on this page for specifying the condition for the rule.

Specifying a condition for a style sheet rule

To specify a condition for a style sheet rule via the Specification panel


  1. Create a style sheet and a rule for it.
  2. Open the Specification panel for the style sheet's rule part usage element.
  3. Specify the condition in the Specification panel's condition compartment:
    1. Specify the needed condition in the Match by field. Click the field to view the dropdown menu with available conditions, then click the needed condition to specify it for the rule.
    2. Specify the condition values in the value field. 

      To specify multiple elements in drag and drop value fields, hold the Ctrl key while dragging and dropping each additional element.

      The value field name and its applicable values depend on the specified condition:
      ConditionValue Field NameDescription
      Explicit ElementsElement

      Drag and drop model elements from the Containment tree or a view to match these specific elements.

      Element KindMetaclass

      Drag and drop a metaclass (e.g., a metaclass from the KerML library or a metadata definition from the SysML library) from the Containment tree to match elements of this type.

      Metadata AnnotationMetadata Definition

      Drag and drop a metadata definition from the Containment tree or a view to match elements annotated with this metadata.

      View TypeView Definition

      Drag and drop a view definition from the Containment tree to match the views of this type. The styles will apply to the symbols displayed in views defined by the specified view definition.

      Custom ExpressionExpression

      Click the Open in Textual Editor button and specify the expression in the Textual Editor. 

      The default expression is true. Replace it with an expression targeting the needed element. Use element to refer to the evaluated item. 

      Example in Textual Editor

      part :> rule {
          part :>> condition : DS_Styles::CoreStylesComponents::Predicates::FreeFormCondition {
              calc :>> test {
                  (element as KerML::Element).name == "vehicle" // targets element symbols named vehicle in all views (to which the style sheet is applied) 
              }
          }
      }

  4. You can now specify styles for the rule and/or assess layout-sensitive changes.