The Rule.context property was intended to allow for evaluating a rule against a different object than the attributes of the feature about to be rendered. But it might be even more useful to define a Style.context to pull property values from.
Example: I have features with an attribute. let's say type. I do not want to do complex rule-based styling, I just want to have a lookup table for the type to choose an externalGraphic:
layer.features[0].attributes = {
type: "scenic"
}
var lookup = {
"recreation": "rec01.png",
"scenic": "icon37.png"
}
var pointSymbolizer = {
externalGraphic: "${type}"
}
var style = new OpenLayers.Style(pointSymbolizer, {context: lookup});
layer.styleMap = new OpenLayers.StyleMap(style);
This would be a first step towards convenience of complex styling.