Testing for a Class Value

Syntax: <yyyy rule="xpath" …/>

Example:

<overlay rule="CLASS('placeholder')" label="Place&#xad;holder Compo&#xad;nent"
pattern="#placeholder" …/>

Use: Test to check if a class is present on an item.

The class attribute is a space-separated list of names. It follows the HTML usage, where if any name is present, that class applies to the component. Testing for the presence of a specific class name leads to verbose XPath expressions. The CLASS() function is used to simplify this. It accepts the single name as the argument and returns a Boolean (true or false) indicating whether that class is present in the list of classes on that component.

For example, <component class="test placeholder" …>

Both CLASS ('test') or CLASS ('placeholder') returns true, but CLASS ('doc') returns false.