caucho
Resin 1.1
FAQ
Reference
JavaDoc
Demo
Java Tutorial

Getting Started
Configuration
Servlet
JSP
XTP/XSL
JavaScript
JS Library

XTP intro
XTP to JSP
XPath
XPath Fun
XSL
XSL lite
XSL lite examples
  XSLT-lite examples

  1. Counter
  2. JSP flow control

Counter

XTP pages can use the counter just by adding the tag:

counter.xtp
A counter example: <ct:counter id='test'/>

Here the patterns to do it. For efficiency, we've added the cache directive. The cache directive tells XTP to execute the stylesheet only once and cache the generated JSP file.

default.xsl
<#@ cache #>

counter[@id] <<
<%=
application.attribute["
<{@id}>"]
%>
>>

counter <<
<%= application.attribute.counter++ %>
>>

JSP flow control

  • ct:get prints the value of a variable
  • ct:if generates an if statement
  • ct:iter loops
definition of ct:get

ct:get <<
<%= <{@expr}> %>
>>
definition of ct:if
ct:if <<
<% if (<{@expr}>) { %>
  <xsl:apply-templates/>
<% } %>
>>
definition of ct:iter
ct:iter[@index] <<
<% for (var <{@index}> in <{@expr}>) { %>
  <xsl:apply-templates/>
<% } %>
>>

ct:iter <<
<% for (var i in <{@expr}>) { %>
  <xsl:apply-templates/>
<% } %>
>>

XSL lite   JavaScript
Copyright © 1998-2000 Caucho Technology. All rights reserved.
Last modified: Thu, 16 Sep 1999 14:56:49 -0700 (PDT)