Stylus Studio XML Editor

Table of contents

Appendices

4 Expressions

Expressions

XSLT uses the expression language defined by XPath [XPATH]. Expressions are used in XSLT for a variety of purposes including:

  • selecting nodes for processing;
  • specifying conditions for different ways of processing a node;
  • generating text to be inserted in the result tree.
  • An expression must match the XPath production Expr.

    Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in Attribute Value Templates.

    In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:

    • the context node comes from the Current Node

    • the context position comes from the position of the Current Node in the Current Node List; the first position is 1

    • the context size comes from the size of the Current Node List

    • the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see [Variables and Parameters])

    • the set of namespace declarations are those in scope on the element which has the attribute in which the expression occurs; this includes the implicit declaration of the prefix xml required by the the XML Namespaces Recommendation [XMLNAMES]; the default namespace (as declared by xmlns) is not part of this set

    • the function library consists of the core function library together with the additional functions defined in [Additional Functions] and extension functions as described in [Extensions]; it is an error for an expression to include a call to any other function