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

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

The SequenceType construct is described in Chapter 4, on page 159, and more fully in Chapter 11, on page 668.

Content

An optional sequence constructor. If a
select
attribute is present, the element must be empty. For function parameters, the element must always be empty.

Effect

An

element at the top level of the stylesheet declares a global parameter; an

element appearing as a child of an

element declares a local parameter for that template, and an

element appearing as a child of an

element declares a local parameter for that function.

The

element defines the name of the parameter, and a default value. The default value is used only if no other value is explicitly supplied by the caller. Default values can be supplied for stylesheet parameters and template parameters, but not for function parameters, which must always be supplied in the function call.

An explicit value can be supplied for a template parameter by using the

element when the template is invoked using

,

,

, or

.

For function parameters, values are supplied in the function call. The syntax of function calls is defined in Chapter 7. Function calls pass parameters positionally rather than by name; the
n
th argument in the function call is evaluated to provide the value for the
n
th

element in the function definition.

The way in which explicit values are supplied for stylesheet parameters is implementation-defined (for example, they may be defined on the command line or through environment variables, or they may be supplied via a vendor-defined API). Microsoft APIs are described in Appendix D, and Java APIs in Appendix E.

The Type of the Parameter

The required type of the parameter can be specified using the
as
attribute. For example,
as=“xs:integer”
indicates that a single integer is expected,
as=“xs:string*”
indicates that a sequence of strings is expected, and
as=“element()+”
indicates that the required type is a sequence of one or more element nodes. With a schema-aware processor it is also possible to supply schema-defined types, for example
as=“abc:vehicle-registration”
indicates that the parameter must be an atomic value conforming to the user-defined atomic type
abc:vehicle-registration
, while
as=“schema-element(EVENT)”
indicates that it must be an element node validated as being either an
EVENT
element or an element in the substitution group of
EVENT
.

Other books

The Man From Her Past by Anna Adams
Hung by Holly Hart
Encore Edie by Annabel Lyon
Tumbling Blocks by Earlene Fowler
Climb the Highest Mountain by Rosanne Bittner