A rule set can also include sorting directives, which determine the order in which targeting results should be returned for display, based on properties of the target objects. The application can then either display the targeting results in that order, or select items from the targeting results based on the order created by the sorting directives. For example, to sort the results of the previous example by company name, in alphabetical order, you write a sorting directive like this and add it to your rule set:

  <sortbyvalue value="company" dir="ascending">

See <sortby> Tag and <sortbyvalue> Tag for details about sorting directives.

Example: A Complete Rule Set

Here is an example of a complete rule set, putting together all the elements discussed in this section:

<!-- This rule delivers items about non-U.S. rubber companies to analysts who
     cover the rubber industry -->

<!-- Accept rules -->

  <rule op=eq name="Rubber sector">
    <valueof target="industry sector">
    <valueof constant="rubber">
  <rule op=includes name="Rubber analysts">
    <valueof bean="Profile.sectorsCovered">
    <valueof constant="rubber">

<!-- Reject rule -->

  <rule op=eq name="U.S. companies"
    <valueof target="companyCountry">
    <valueof constant="United States">

<!-- Sorting Directive -->

  <sortbyvalue value="company" dir=ascending>