<title>XTP Identity</title>

<p/>XTP (XML template pages) lets you ease into XML and XSLT
(XML Stylesheet Tranformations).  Your XTP pages can be almost identical to
JSP pages and just use XSLT to eliminate repetitious error-prone patterns.

<p/>XTP transforms XML or HTML documents into a XML or HTML output.  In
other words, it's an XML transformation.  So each XTP page has four parts:
<ol>
<li>The input XML (the XTP file)
<li>The transformation stylesheet (the XSL file)
<li>The generated JSP
<li>The generated output (the result of executing the JSP)
</ol>

<p/>The easiest transformation is the identity transformation.  The following
stylesheet copies the input into the output.

<p/>The following syntax uses Resin's <var/StyleScript/> as the stylesheet
language.  StyleScript is semantically equivalent to strict XSL, but it less
verbose and more readable.  A <a href="xtp-strict.xtp">following page</a>
uses strict XSL.

<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()|@*);
  >>
>>
</example>

<p/>Each <var/template/> contains a <var/match/> pattern and a
<var/replacement tree/>.  The match pattern is an <var/XPath/> expression.
In the above example, the match pattern <var/*|@*/> matches any element
and any attribute.  The replacement <var/$copy()/> copies the current
node and calls <var/$apply-templates()/> to recursively evaluate
any children of the current node.

<p/>You can put <var/default.xsl/> in the same directory as the xtp
file, or you can put in WEB-INF/xsl, or you can put it in the
classpath like WEB-INF/classes.  The last option is useful if you want
to create a jar of useful stylesheets and beans. 

<p/>Your XTP page may look something like:

<example title='test.xtp'>
&lt;h1>My test&lt;/h1>

Adding: 2 + 2 = &lt;%= 2 + 2 %>
</example>

<p/>The generated JSP is identical to the input, and the generated HTML
just executes the JSP.

<results>
&lt;h1>My test&lt;/h1>

Adding: 2 + 2 = 4
</results>
