XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (684 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
2.67Mb size Format: txt, pdf, ePub

,
<
, or

, because these are all equivalent according to the XML standard. The one thing it will not write is
<
. So, it doesn't matter how you write the
<
in your input: the serializer sees a
<
and escapes it in the output.

There are several valid reasons why you might not want this behavior. For example:

  • The output is not XML or HTML at all; it is (say) a data file in comma-separated-values format.
  • The output is HTML and you want to exploit one of the many HTML quirks where special characters are needed without escaping; for example, a
    <
    sign in a piece of client-side JavaScript on your HTML page.
  • The output is XML and you want to achieve some special effect that the XSLT processor doesn't allow; for example, outputting an entity reference such as
    ¤t-date;
    or an internal DTD subset containing an entity declaration.
  • The output is some format that uses angle-bracket syntax but is not pure XML or HTML; for example, ASP.NET pages or Java Server Pages, which both use
    <%
    and
    %>
    as delimiters, or XQuery, in which an unescaped
    <
    can be used as an operator symbol. (If you are generating Java Server Pages, note that these have an alternative syntax that is pure XML; however, this is not widely used.)

Other books

Immortal in Death by J. D. Robb
Pleasure for Pleasure by Jamie Sobrato
Truly, Madly by Heather Webber
Double Shot by Christine D'Abo
Starfist: A World of Hurt by David Sherman; Dan Cragg
Congo by David Van Reybrouck
Lazarillo Z by Lázaro González Pérez de Tormes
Getting a Life by Loveday, Chrissie
On a Highland Shore by Kathleen Givens