%
use Apache::Request;
my $apr = Apache::Request->new($r);
my $sect = $apr->param('section');
$r->no_cache(1);
my $this_page = $r->uri;
my ($prev, $next);
my $sects = findvalue('count(/article/sect1)');
$sects = "$sects";
if ($sects > 1) {
if ($sect >= $sects) {
$prev = $sects - 1;
}
elsif ($sect <= 1) {
$next = 2;
}
else {
$prev = $sect - 1;
$next = $sect + 1;
}
}
%>
<%= findvalue('/article/artheader/title/text()') %>
<%
if (!$sect) {
# display title/TOC page
print apply_templates('/article/artheader/*');
my $page = 0;
foreach my $sect (findnodes('/article/sect1')) {
$page++;
print "";
print findvalue('title/text()', $sect);
print "
\n";
}
%>
<%
}
else {
%>
<%
if ($prev) {
%>
Prev
<% } else {
%>
Prev
<% } %>
| Top |
<%
if ($next) {
%>
Next
<% } else { %>
Next
<% } %>
|
<%
# display particular page
foreach my $section (findnodes("/article/sect1[$sect]")) {
# should only be 1
print apply_templates($section);
}
}
%>