|
|
 |

Rewriting links to encode sessions is a tedious and error-prone task.
If you use URL-encoded sessions, every <a> link and every <form> action
needs a rewritten link using response.encodeURL(). XTP can rewrite
those for you automatically.
stylesheet.xsl
<!-- make sure '<' is not printed as '<' --> $output(disable-output-escaping=>true);
<!-- copy input to output --> *|@* << $copy() << $apply-templates(node()|@*); >> >>
<!-- rewrite <a href> --> a[@href] << <a href='<%= response.encodeURL("{@href}") %>'> $apply-templates(node()|@*[name(.)!="href"]); </a> >>
|
Your XTP page may look something like:
test.xtp
<?xml-stylesheet href='stylesheet.xsl'?> <h1>My test</h1>
Adding: 2 + 2 = <%= 2 + 2 %>
<p>New? <%= session.isNew() %>
<p>And <a href='test.xtp'>linking</a>
|
The transformed file will look like:
<?xml-stylesheet href='stylesheet.xsl'?>
<h1>My test</h1>
Adding: 2 + 2 = <%= 2 + 2 %>
<p>New? <%= session.isNew() %>
<p>And <a href='<%= response.encodeURL("test.xtp") %>'>linking</a>
|
Copyright © 1998-2001 Caucho Technology. All rights reserved.
Copyright © 1998-2001 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.
|
 |
|