Unlike other map components such as themes and styles, legends cannot be included as part of the static definition of a named map. That is, the named resource schemas do not provide any elements for including a legend in a named map's definition file. Instead, legends are always generated 'on-the-fly' when the named map is requested, based on the defined themes and styles of the map's layers.
A map legend is composed of individual legend entries or rows. Each legend entry in turn is composed of a symbol or color swatch followed by a text description. When you submit a request for the legend of a named map, zero, one, or more legend entries are returned for each layer in the named map.