sc:type-apply

sc:type-apply(
   $type as schema-type(),
   $arg as item()
) as item()*

Summary

Apply a type to an item to construct a typed instance of that type. If the type is a simple type this amounts to casting. If the type is a complex type this amounts to validating as that type.

Parameters
type The type to apply.
arg The item to apply the type to.

Example

sc:type-apply( sc:type-named(xs:QName('xs:integer')), "47" )
  => 47
Powered by MarkLogic Server | Terms of Use | Privacy Policy