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

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
9.52Mb size Format: txt, pdf, ePub
ads
CastableExpr
CastExpr
(
castable
as
SingleType )?
CastExpr
UnaryExpr
(
cast
as
SingleType )?
UnaryExpr
(

|
+
)* PathExpr

These expressions all have a similar form: each defines an expression in terms of expression in the row below combined with particular infix or prefix operators. These operators are all described in the fol lowing chapters, according to the role that they play.

At the level of
PathExpr
, the syntax starts to become rather more specialized again, which shouldn't be surprising because path expressions are the characteristic feature of the XPath language that gives it its special flavor. Chapter 9 is devoted to path expressions, where you will find the full syntax.

Below the level of path expressions, the most primitive expressions in the language are referred to as primary expressions. At that level we will pick up the story again in this chapter, on page 539.

As explained in Chapter 1, XPath is a read-only expression language. It's a general principle of XPath that expression evaluation is free of side effects: evaluating an expression isn't going to change the values of any variables, write information to log files, or prompt the user for their credit card number. Therefore evaluating the same expression more than once, in the same context, shouldn't make any difference to the answer or to the final output, and equally it shouldn't make any difference in which order expressions are evaluated. As a result, the XSLT and XPath specifications generally say nothing about order of evaluation.

The only way side effects can occur from evaluating an expression is if the expression calls user-written (or vendor-written) extension functions, because the XPath specification doesn't constrain what an extension function can do. Equally, it makes no guarantees about when, and in what order, extension functions are called.

Examples

Examples of expressions occur throughout this book. Here is a selection, brought together to indicate the variety of constructs that fall under this heading. Like many of the examples of XPath expressions in this section of the book, these have been collected together into XSLT stylesheets, complete with sample data, so that you can see for yourself how they work and experiment with your own changes. You'll find these particular examples in a file called
ch07/expressions.xsl
in the download for this book. Make a note of what else is available in the downloads, because I won't always be mentioning the file names explicitly.

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

Other books

The Kind One by Tom Epperson
Reaping by Makansi, K.
Her Mountain Man by Cindi Myers
Unexpected Changes by A.M. Willard
Sleep Toward Heaven by Ward, Amanda Eyre