| |
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++ %>
>>
|
- 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/>
<% } %>
>>
|
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc. | |
|