HTML templating module
version | 2.1 |
author | Wolfgang Meier |
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>
$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. |
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>
$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()* |
templates:copy-node($node as element(), $model as item()*) as item()*
$node | $node |
$model* | $model* |
templates:each($node as node(), $model as map(*), $from as xs:string, $to as xs:string) as item()*
$node | $node |
$model | $model |
$from | $from |
$to | $to |
templates:error-description($node as node(), $model as map(*)) as item()*
$node | $node |
$model | $model |
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.
$node | $node |
$model | $model |
templates:get-app-root($model as map(*)) as xs:string?
$model | $model |
templates:get-root($model as map(*)) as xs:string?
$model | $model |
templates:if-attribute-set($node as node(), $model as map(*), $attribute as xs:string) as item()*
$node | $node |
$model | $model |
$attribute | $attribute |
templates:if-model-key-equals($node as node(), $model as map(*), $key as xs:string, $value as xs:string) as item()*
$node | $node |
$model | $model |
$key | $key |
$value | $value |
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.
$node | $node |
$model | $model |
$uri | $uri |
$at | $at |
templates:if-parameter-set($node as node(), $model as map(*), $param as xs:string) as node()*
$node | $node |
$model | $model |
$param | $param |
templates:if-parameter-unset($node as node(), $model as item()*, $param as xs:string) as node()*
$node | $node |
$model* | $model* |
$param | $param |
templates:include($node as node(), $model as map(*), $path as xs:string) as item()*
$node | $node |
$model | $model |
$path | $path |
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
$uri | $uri |
$relLink? | $relLink? |
templates:load-source($node as node(), $model as map(*)) as node()*
$node | $node |
$model | $model |
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.
$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. |
templates:resolve($uri as xs:string) as xs:string?
$uri | $uri |
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()*
$node | $node |
$model | $model |
$with | $with |
$at? | $at? |
$using? | $using? |
$options? | $options? |
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.
$node | $node |
$model | $model |
$key | $key |
$value | $value |