template:apply

Purpose

Applies a template to the bound parameter values. If the optional href attribute is set, the template:binding element must be used to specify a binding. If the attribute is omitted, multiple template:bindings and a nested template:definition must be used.

Contains

Attribute

Attribute Description Type Default Options Use
href The URI of the template that is to be applied. xs:anyURI 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