template:parameter

Purpose

Defines a parameter. If the default value of the parameter is fixed, it should be set using the default attribute. If it is dynamic, or larger than can be used as an attribute, then it can be set using a nested element appropriate to the parameter type.

Contains

Contained by

Attributes

Attribute Description Type Default Options Use
default The default value of the parameter for both simple or complex parameters xs:string none    optional 
expressionVariable The name of the expression variable to which a simple value should be bound. This can only be specified for simple parameters. xs:QName none    optional 
name Name of the parameter that must be unique within the template. xs:NCName none    required 
type The simple type may be character data only. The complex type may contain character data and pipeline markup. xs:string none  simple, complex  required 
use If a parameter is required, it is invalid to also define a value in the default attribute. If a parameter is optional it must have a default value. xs:string required  required, optional  optional 

Examples

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:template="http://www.volantis.com/xmlns/marlin-template">
  <head>
    <title>Template elements</title>
  </head>
  <body>
    <template:apply href="test.xdtpl">
      <template:binding name="title" value="Welcome to Jive Intranet"/>
      <template:binding name="subtitle">
        <template:simpleValue>Jive Human Resources</template:simpleValue>
      </template:binding>
      <template:binding name="content">
        <template:complexValue>
          <div>
            <p>Jive Sports is seeking people to fill new job openings.</p>
          </div>
        </template:complexValue>
      </template:binding>
    </template:apply>
  </body>
</html>

The test.xdtpl template may look like this.

<?xml version="1.0" encoding="UTF-8"?>
<template:definition xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:template="http://www.volantis.com/xmlns/marlin-template">
  <template:documentation> </template:documentation>
  <template:declarations>
    <template:parameter name="title" type="simple"/>
    <template:parameter name="subtitle" type="simple"/>
    <template:parameter name="content" type="complex"/>
  </template:declarations>
  <template:body>
    <h2>
      <template:value ref="title"/>
    </h2>
    <h3>
      <template:value ref="subtitle"/>
    </h3>
    <div>
      <template:value ref="content"/>
    </div>
    <div>
      <p>Copyright <a href="#">Jive Sports</a></p>
    </div>
  </template:body>
</template:definition>

Related topics