<% my %links; my $linkid = 0; $t->{'ulink'}{testcode} = sub { my $node = shift; my $t = shift; my $url = findvalue('@url', $node); if (!exists $links{$url}) { $linkid++; $links{$url} = $linkid; } my $link_number = $links{$url}; $t->{pre} = ""; $t->{post} = " [$link_number]"; return 1; }; %> <%= findvalue('/article/artheader/title/text()') %>
<%= spacer(10,0) %> <% # display title/TOC page print apply_templates('/article/artheader/*'); %>
<% # display all pages foreach my $section (findnodes("/article/sect1")) { print apply_templates($section); } %>

List of Links

<% for my $link (sort {$links{$a} <=> $links{$b}} keys %links) { %> <% } %>
URL
<%= "[$links{$link}] $link" %>
<% if (@footnotes) { print "
"; print ""; my $i = 1; foreach my $footnote (@footnotes) { print ""; $i++; } print "
Footnotes

$i

$footnote

"; } %>