#!/usr/bin/perl
#
# Prerequisits:
# apt-get install apache2-mod_perl perl-XML-LibXSLT
#
# mod_perl transformation
#
package bookmarks;

use strict;
use warnings;

use Apache2::RequestRec();
use Apache2::RequestIO();

use Apache2::Const -compile => qw(OK DECLINED);

use XML::LibXSLT;
use XML::LibXML;

my $parser = XML::LibXML->new();
my $xslt = XML::LibXSLT->new();

my $stylesheet = $xslt->parse_stylesheet_file("/var/www/apache2/html/bookmarks/bookmarks.xsl");

sub handler {
	my $r = shift;

	$r->content_type('text/plain');
	$r->content_encoding('utf-8');

	print $stylesheet->output_string($stylesheet->transform_file("/etc/httpd2/uploads/bookmarks.xbel.xml"));

	return Apache2::Const::OK;
}

1;
