1.3 Templates

Templates are XML documents that are processed by a style sheet in order to generate an output document. The output document can be XML, HTML, or plain text (or anything else that can be generated through XSLT).

Templates are used in the Manual Task Service driver to generate e-mail message text on the Subscriber channel, and to generate dynamic Web pages and XDS documents on the Publisher channel.

Templates contain text, elements, and replacement tokens. Replacement tokens are replaced in the output document by data supplied to the style sheet processing the template.

Several examples of templates for various purposes follow. In the examples, the replacement tokens are the character strings that are between two $ characters.

Templates can also contain action elements. Action elements are control elements interpreted by the template-processing style sheet. Action elements are described in Section D.0, Template Action Elements.

The following example template is used to generate an HTML e-mail message body:

<html xmlns:form="http://www.novell.com/dirxml/manualtask/form">
<head></head>
<body>
Dear $manager$,<p/>
<p>
This message is to inform you that your new employee <b>$given-name$ $surname$</b> has been hired.
<p>
You need to assign a room number for this individual. Click <a href="$url$">Here</a> to do this.
</p>
<p>
Thank you,<br/>
HR Department
</p>
</body>
</html>

The following example template is used to generate a plain text e-mail message body:

<form:text xmlns:form="http://www.novell.com/dirxml/manualtask/form">
Dear $manager$,

This message is to inform you that your new employee $given-name$ $surname$ has been hired. 

You need to assign a room number for this individual. Use the following link to do this:

$url$

Thank you,

The HR Department

</form:text>

The <form:text> element is required because templates must be XML documents. The <form:text> element is stripped as part of the template processing.

The following template is used to generate an HTML form used as a Web page for entering data:

<html  xmlns:form="http://www.novell.com/dirxml/manualtask/form">
<head>
<title>Enter room number for $subject-name$</title>
</head>
<body>
    <link href="novdocmain.css" rel="style sheet" type="text/css"/>
    <br/><br/><br/><br/>
    <form class="myform" METHOD="POST" ACTION="$url-base$/process_template.xsl">
        <table cellpadding="5" cellspacing="10" border="1" align="center">
          <tr><td>
          <input TYPE="hidden" name="template" value="post_form.xml"/>
          <input TYPE="hidden" name="subject-name" value="$subject-name$"/>
          <input TYPE="hidden" name="association" value="$association$"/>
          <input TYPE="hidden" name="response-style sheet" value="process_template.xsl"/>
          <input TYPE="hidden" name="response-template" value="post_response.xml"/>
          <input TYPE="hidden" name="auth-style sheet" value="process_template.xsl"/>
          <input TYPE="hidden" name="auth-template" value="auth_response.xml"/>
        <input TYPE="hidden" name="protected-data" value="$protected-data$"/>
          You are:<br/>
          <form:if-single-item name="responder-dn">          
            <input TYPE="hidden" name="responder-dn" value="$responder-dn$"/>
            $responder-dn$
          </form:if-single-item>          <form:if-multiple-items name="responder-dn">            <form:menu name="responder-dn"/>          </form:if-multiple-items>
        </td></tr>
        <tr><td>          
          Enter your password: <br/>
<input name="password" TYPE="password" SIZE="20" MAXLENGTH="40"/>
        </td></tr>
        <tr><td>          
          Enter room number for $subject-name$:<br/>
          <input TYPE="text" NAME="room-number" SIZE="20" MAXLENGTH="20" value="$query:roomNumber$"/>
        </td></tr>
        <tr><td>          
          <input TYPE="submit" value="Submit"/> <input TYPE="reset" value="Clear"/>
        </td></tr>
      </table>        
    </form>
  </body>    
</html>

The following template is used to generate an XDS document:

<nds>
  <input>
    <modify class-name="User" src-dn="not-applicable">
      <association>$association$</association>
      <modify-attr attr-name="roomNumber">
        <remove-all-values/>
        <add-value>
          <value>$room-number$</value>
        </add-value>
      </modify-attr>
    </modify>
  </input>
</nds>