template:binding

Purpose

Specifies a binding to a parameter value. If a value is fixed, then it should be set using the value attribute. If value 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
name Name of parameter that must be unique within the set of bindings. xs:NCName none    required 
ref A reference to a parameter in the containing definition whose value is used as the value of this parameter. xs:NCName none    optional 
value Although optional, if not set it must be specified some other way. xs:string none    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