It is sometimes useful to set style properties based on the context of the element. A typical example is the newspapers' bold paragraph after a headline:
/H1 P/: font.style = boldIn the style sheet, the initial "/" indicates the start of a pattern search. The trailing "/" is optional. All property assignments are performed on the last element of the search pattern. Subclasses can be specified in the search pattern:
/H1 P.ingress/: font.style = bold
The above examples are sequential patterns. Only top-level start tags (e.g P, H1, UL) are regarded in sequential search patterns.
By specifying a hierarchical search pattern, one can set properties based on the ancestors of an element. E.g., since headlines often are rendered in bold, one may want to assign a different color to the STRONG element within an headline:
(H1 STRONG): font.color = SteelBlueThis is also how you would control the appearance of various list levels:
(UL LI) : font.style = bold & italic (UL(OL(LI))) : font.color = red (UL(UL(LI : font.color = darkgreenNote the variations in the syntax. They are all allowed, but which is the most intuitive?
Sample rendering: