Table of contentsAppendices |
4.5 Construction of Entity Replacement TextConstruction of Entity Replacement TextIn discussing the treatment of entities, it is useful to distinguish two forms of the entity's value. For an internal entity, the literal entity value is the quoted string actually present in the entity declaration, corresponding to the non-terminal EntityValue. For an external entity, the literal entity value is the exact text contained in the entity. For an internal entity, the replacement text is the content of the entity, after replacement of character references and parameter-entity references. For an external entity, the replacement text is the content of the entity, after stripping the text declaration (leaving any surrounding white space) if there is one but without any replacement of character references or parameter-entity references. The literal entity value as given in an internal entity declaration (EntityValue) MAY contain character, parameter-entity, and general-entity references. Such references MUST be contained entirely within the literal entity value. The actual replacement text that is Include (or Included in Literal) as described above MUST contain the replacement text of any parameter entities referred to, and MUST contain the character referred to, in place of any character references in the literal entity value; however, general-entity references MUST be left as-is, unexpanded. For example, given the following declarations: <!ENTITY % pub "Éditions Gallimard" > <!ENTITY rights "All rights reserved" > <!ENTITY book "La Peste: Albert Camus, © 1947 %pub;. &rights;" > then the replacement text for the entity " La Peste: Albert Camus, © 1947 Éditions Gallimard. &rights; The general-entity reference " These simple rules may have complex interactions; for a detailed discussion of a difficult example, see [Expansion of Entity and Character References]. |