use strict;
use HTML::Template;
use XML::Simple;
my $xml = XMLin('./faq.xml') or die $!;
my $template = HTML::Template->new(
filename => 'faq.tmpl',
die_on_bad_params => 0,
);
# this could definitely use some refactoring - oh well ;)
foreach my $cat (@{$xml->{'category'}}) {
$cat->{'anchor'} = $cat->{'type'};
$cat->{'anchor'} =~ s/ /_/g;
$cat->{'anchor'} =~ s/[^\w]//g;
}
$template->param(
category => $xml->{'category'},
);
print $template->output();