XQuery Function Documentation
http://exist-db.org/xquery/templates
/db/apps/shared-resources/content/templates.xql
HTML templating module
version | 2.1 |
author | Wolfgang Meier |
templates:apply #3
templates:apply ($content as node()+, $resolver as function(*), $model as map(*)?) as item()
Start processing the provided content. Template functions are looked up by calling the provided function $resolver. The function should take a name as a string and return the corresponding function item. The simplest implementation of this function could look like this: <pre>function($functionName as xs:string, $arity as xs:int) { function-lookup(xs:QName($functionName), $arity) }</pre>
- Parameters:
$content the sequence of nodes which will be processed $resolver a function which takes a name and returns a function with that name $model a sequence of items which will be passed to all called template functions. Use this to pass information between templating instructions. - Returns:
- item()*
templates:apply #4
templates:apply ($content as node()+, $resolver as function(*), $model as map(*)?, $configuration as map(*)?) as item()
Start processing the provided content. Template functions are looked up by calling the provided function $resolver. The function should take a name as a string and return the corresponding function item. The simplest implementation of this function could look like this: <pre>function($functionName as xs:string, $arity as xs:int) { function-lookup(xs:QName($functionName), $arity) }</pre>
- Parameters:
$content the sequence of nodes which will be processed $resolver a function which takes a name and returns a function with that name $model a sequence of items which will be passed to all called template functions. Use this to pass information between templating instructions. $configuration a map of configuration parameters. For example you may provide a 'parameter value resolver' by mapping $templates:CONFIG_PARAM_RESOLVER to a function whoose job it is to provide values for templated parameters. The function signature for the 'parameter value resolver' is f($param-name as xs:string) as item()* - Returns:
- item()*
templates:copy-node #2
templates:copy-node ($node as element(), $model as item()*) as item()
- Parameters:
$node $model - Returns:
- item()*
templates:each #4
templates:each ($node as node(), $model as map(*), $from as xs:string, $to as xs:string) as item()
- Parameters:
$node $model $from $to - Returns:
- item()*
templates:error-description #2
templates:error-description ($node as node(), $model as map(*)) as item()
- Parameters:
$node $model - Returns:
- item()*
templates:form-control #2
templates:form-control ($node as node(), $model as map(*)) as node()
Processes input and select form controls, setting their value/selection to values found in the request - if present.
- Parameters:
$node $model - Returns:
- node()*
templates:get-app-root #1
templates:get-app-root ($model as map(*)) as xs:string
- Parameters:
$model - Returns:
- xs:string?
templates:get-root #1
templates:get-root ($model as map(*)) as xs:string
- Parameters:
$model - Returns:
- xs:string?
templates:if-attribute-set #3
templates:if-attribute-set ($node as node(), $model as map(*), $attribute as xs:string) as item()
- Parameters:
$node $model $attribute - Returns:
- item()*
templates:if-model-key-equals #4
templates:if-model-key-equals ($node as node(), $model as map(*), $key as xs:string, $value as xs:string) as item()
- Parameters:
$node $model $key $value - Returns:
- item()*
templates:if-module-missing #4
templates:if-module-missing ($node as node(), $model as map(*), $uri as xs:string, $at as xs:string) as item()
Evaluate the enclosed block if there's a model property $key equal to $value.
- Parameters:
$node $model $uri $at - Returns:
- item()*
templates:if-parameter-set #3
templates:if-parameter-set ($node as node(), $model as map(*), $param as xs:string) as node()
- Parameters:
$node $model $param - Returns:
- node()*
templates:if-parameter-unset #3
templates:if-parameter-unset ($node as node(), $model as item()*, $param as xs:string) as node()
- Parameters:
$node $model $param - Returns:
- node()*
templates:include #3
templates:include ($node as node(), $model as map(*), $path as xs:string) as item()
- Parameters:
$node $model $path - Returns:
- item()*
templates:link-to-app #2
templates:link-to-app ($uri as xs:string, $relLink as xs:string?) as xs:string
Locates the package identified by $uri and returns a path which can be used to link
to this package from within the HTML view of another package.
$uri the unique name of the package to locate
$relLink a relative path to be added to the returned path
- Parameters:
$uri $relLink - Returns:
- xs:string
templates:load-source #2
templates:load-source ($node as node(), $model as map(*)) as node()
- Parameters:
$node $model - Returns:
- node()*
templates:process #2
templates:process ($nodes as node()*, $model as map(*)) as item()
Continue template processing on the given set of nodes. Call this function from within other template functions to enable recursive processing of templates.
- Parameters:
$nodes the nodes to process $model a sequence of items which will be passed to all called template functions. Use this to pass information between templating instructions. - Returns:
- item()*
templates:resolve #1
templates:resolve ($uri as xs:string) as xs:string
- Parameters:
$uri - Returns:
- xs:string?
templates:surround #6
templates:surround ($node as node(), $model as map(*), $with as xs:string, $at as xs:string?, $using as xs:string?, $options as xs:string?) as item()
- Parameters:
$node $model $with $at $using $options - Returns:
- item()*
templates:unless-model-key-equals #4
templates:unless-model-key-equals ($node as node(), $model as map(*), $key as xs:string, $value as xs:string) as item()
Evaluates its enclosed block unless the model property $key is set to value $value.
- Parameters:
$node $model $key $value - Returns:
- item()*