template:value

Purpose

Identifies the position to insert parameter content in the document. This may be used at any point within the body of the template. If the parameter has not been declared, or is not of simple type then an error is raised.

Contained by

Attribute

Attribute Description Type Default Options Use
ref Returns the simple value bound to the referenced parameter name. Cannot be used in an attribute expression. xs:NCName none    required 

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 file must contain the following code.

<?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