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

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

Format

  name = qname

  select? = expression

  as? = sequence-type>

  


Position

The

element may appear either as a top-level declaration (that is, as a child of the

element), or as an instruction within a sequence constructor.

Attributes

Name
Value
Meaning
name
mandatory
Lexical QName
The name of the variable.
select
optional
Expression
An expression that is evaluated to give the value of the variable. If omitted, the value is determined from the contents of the

element.
as
optional
SequenceType
Declares the type of the variable. A type error occurs if the value of the expression cannot be converted to this type using the standard type conversions defined below (page 505). In addition, the presence of this attribute on an

element with nonempty content indicates that the result of evaluating the contained sequence constructor is to be used directly as the value of the variable, rather than being used to construct a temporary document.

The
SequenceType
construct is described in Chapter 11.

Content

An optional sequence constructor. If a
select
attribute is present, the

element must be empty.

Effect

An

element may appear either at the top level of the stylesheet (in which case it declares a global variable) or as an instruction within a sequence constructor (in which case it declares a local variable).

The Name of the Variable

The name of the variable is defined by a lexical QName. Normally, this will be a simple name such as
city
or
total-sales
, but it may be a name qualified with a prefix, for example
my:value
. If it has a prefix, the prefix must correspond to a namespace that is in scope at that point in the stylesheet. Two variables,
my:value
and
your:value
, have matching names if the prefixes
my
and
your
refer to the same namespace URI. If the name has no prefix, it has a null namespace URI—it does not use the default namespace URI.

Other books

How They Started by David Lester
Sierra's Homecoming by Linda Lael Miller
Kate by Katie Nicholl
Sentido y sensibilidad y monstruos marinos by Jane Austen, Ben H. Winters
Civilian Slaughter by James Rouch
Returning Home by Karen Whiddon
Lady Afraid by Lester Dent
Throw Like A Girl by Jean Thompson
Bachelor Unleashed by Brenda Jackson