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

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

Some other factors that have influenced the design of the XPath syntax include:

  • A decision that XPath should have no reserved words. This means that any name that is legal as an XML element name (which includes names such as
    and
    and
    for
    ) should be legal in a path expression, without any need for escaping. As a result, all names used with some other role, for example function names, variable names, operator names, and keywords such as
    for
    , have to be recognizable by their context.
  • In both the original applications for XPath (that is, XSLT and XPointer), the language was designed to be embedded within the attributes of an XML document. It therefore has no mechanisms of its own for character escaping, relying instead on the mechanisms available at the XML level (such as numeric character references and entity references). This also made the designers reluctant to use symbols such as
    &&
    , which would require heavy escaping. This principle has been abandoned in XPath 2.0 with the introduction of the operators
    <<
    and
    >>
    ; however, these operators are not likely to be used very often.
  • There was originally an expectation that XPath expressions (especially in an XPointer environment) would often be used as fragment identifiers in a URI. This usage of XPointer never really took off, but it meant there was a reluctance to use special characters such as
    #
    ,
    %
    , and
    ?
    that have special significance in URIs.

Other books

Justice by Larry Watson
The Survivors Club by Lisa Gardner
Betrayed by Morgan Rice
Haunted by Amber Lynn Natusch
Sweet Hill Homecoming by Ryan, Joya
The Boys of My Youth by Jo Ann Beard
Fiction Ruined My Family by Jeanne Darst
Alone by Tiffany Lovering