LXP automatically converts any recognized entity within an LXP tag's attribute value into its literally interpreted character symbol. As of Version 0.8, LXP's recognized entities consist of the five pre-defined XML entities:
It's useful to know about entity substitution, as sometimes both apostrophes and quotes may be needed within the
value of an LXP tag attribute, making it otherwise impossible to insert them without the use of these entities. LXP's
developers considered programmatic back-slash escape sequences as a means to solve this (as is common in other programming
languages), but LXP's ability to natively handle entities both preserves the mark-up mentality and adds a new level of
sophistication to the language.
Example 13-11 provides an example of entity substitution within the LXP
Example 13-11. Using entity substitution
<setvar field="field_two" />
<include sql="SELECT field_one, $field FROM "CAPITALIZED_TABLE""
<strong>Column One:</strong> <field name="field_one" /><br>
<strong>Column Two:</strong> <field name="field_two" /><br>
Example 13-11 demonstrates the use of entities inside of a direct SQL query in order to
place quotes within quotes. This is frequently required to make identifiers case-sensitive within PostgreSQL, as
identifiers are otherwise folded to lowercase.
When parsed, the " is changed into its literal counter-part, making the
actual executed query as follows:
SELECT field_one, field_two FROM "CAPITALIZED_TABLE"
See the Section called Including SQL Content
" for an explanation of what exactly this example's LXP markup would achieve.