<title section="Resin : JSP Tutorial : XTP : ">Format Sections</title>

<p/>A major advantage of XTP is its separation of content from formatting.
Your source documents can use meaningful markup tags letting the stylesheet
format the output.

<p/>The XTP source of this tutorial uses a few tags for basic formatting:
<var/&lt;section>/>, <var/&lt;example>/>, and <var/&lt;var>/>.

<p/>For example, the source for the tutorial index contains a section
like:

<example title="index.xtp">
&lt;ct:section title="XTP">
&lt;ul>
&lt;li>&lt;a href="xtp-copy.xtp">XTP copy&lt;/a> treats XTP pages exactly like JSP.
&lt;li>&lt;a href="xtp-format.xtp">Format&lt;/a> sections, splitting style from content
&lt;li>&lt;a href="xtp-page.xtp">Encode links&lt;/a> for sessions automatically
&lt;li>&lt;a href="xtp-strict.xtp">Strict XSL&lt;/a> equivalent to StyleScript
&lt;/ul>
&lt;/ct:section>
</example>

<p/>The stylesheet contains a new rule for <var/ct:section/>.  In this
example, the rule only works when there is a <var/title/> attribute.  In the
replacement code, <var/$(@title)/> inserts the value of the <var/title/>
attribute.

<example title="default.xsl">
&lt;!-- make sure '&lt;' is not printed as '&amp;lt;' -->
$output(disable-output-escaping=>true);

&lt;!-- copy input to output -->
*|@* &lt;&lt;
  $copy() &lt;&lt;
    $apply-templates(node()|@*);
  >>
>>

&lt;!-- section format -->
ct:section[@title] &lt;&lt;
  &lt;table width="100%" cellpadding="5" border="0">
  &lt;tr bgcolor="#ccddff">&lt;td>
    &lt;font size="+2">&lt;b>$(@title)&lt;/b>&lt;/font>
  &lt;/td>&lt;/tr>
  &lt;/table>

  $apply-templates();
>>
</example>
