as

Table of Contents

Declaration
Related GitHub issue(s)
Sample usage
Commentary

Element context(s)

This attribute is optional and expresses the datatype of a variable declared by element let.

Clause 5.4.7 (let element)

The optional as attribute is the datatype of the variable. The query language binding shall determine whether the as attribute is supported and how it is processed.

Declaration

let =
    element let {
        attribute name { nameValue },
        attribute as { text }?,
        (attribute value { string }
         | foreign-element+)
    }

Related GitHub issue(s)

Typed variables

Sample usage

Example 1. as attribute: value attribute of sch:let

<sch:let name='foo' as='xs:integer' value='12'/>

Example 2. as attribute: element content of sch:let

<sch:let name='foo' as='element(foo)'><foo/></sch:let>

Commentary

The introduction of this attribute removes the need for implementations to provide custom workarounds, for example the use of xsl:variable in XSLT.