Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
If the
as
attribute is omitted, then the supplied value may be of any type.
The value that is actually supplied by the caller must be suitable for the required type. The value is converted if necessary using the standard conversion rules described on page 505, and it is a fatal error if this conversion fails. Because the ability to specify a type on
1.0
. In summary, this means that the only conversions allowed are:
If the supplied parameter is the wrong type, then the error may be detected either at compile time or at runtime. With stylesheet parameters, however, the supplied value isn't known until runtime, so this is when the error will occur.
The
as
attribute on
as
attribute on
declares a parameter whose default value is a temporary tree consisting of a document node, which owns a text node whose string value is
Madrid
; while:
declares a parameter whose required type is a single string, and whose default value is the string
Madrid
. If you really need to say that the required type is a document node, and to supply a temporary document as the default value, then you can write it like this: