On 6/18/07, [EMAIL PROTECTED] > > So, after the
advice I got on this list, I decided to give it a go and
> run AxKit2 to deliver XML-turned-HTML files on our site. The very
> basic setup works well so far: using Apache as a main server and,
> using mod_rewrite, letting .xml files (and only those) be delivered by
> the second AxKit server.

Could you write an idiots guide for that please? It sounds useful.

The idiot just added the following code to his Apache config file:

RewriteEngine On
RewriteRule \.(gif|jpg|pdf|css|js)$ - [last]
RewriteRule ^/(.*)$ http://localhost:8000/$1 [proxy]

which sends everything but files whose name end on.gif, .jpg etc. to
the AxKit server which runs on the same machine, on port 8000.

However, if I just wanted to do XSLT-translations for my XML files and
have them delivered as HTML to our site's visitors, I would have
forgotten about the whole Apache thing. I wantr to distinguish between
visitors and let the XSLT stylesheets not show certain parts of a page
if they do not have certain session variables set. And in some cases,
I use mod_perl to deny access altogether.

I haven't even started to think about how to do this. But since
URI-translation in Apache (and thus mod_perl) is done before any
authentication takes place, it doesn't look very likely that in this
setup Apache will block any user access.

Thanks also for your suggestions on how to do something similar to
AxAddRootProcessor. I've been playing all afternoon and I've written a
simple plugin that kind of does the trick. Matt is very right when he
claims that writing plugins for AxKit2 is very easy!

However, something funny happens with the plugin that I've written and
copied below: after the first request, which works fine, there is no
transformation taking place anymore, neither if I reload the same xml
file in the browser, nor if I open a new one. It doesn't happen to the
default demo plugin, so am afraid I am just missing something very
obvious...

Martijn.

# the following subroutine is part of demo/serve_myxslt,
# which is very similar to demo/serve_xslt
# (installed with AxKit)

sub hook_xmlresponse {
   my ($self, $input) = @_;

   my $xmlroot = $input->dom->documentElement->nodeName;
   my $rootprocessors = $self->xslt_stylesheets($self->config);
   my @stylefile;
   my $out = $input;
   # $rootprocessors is an array where every even-numbered element is
a stylesheet
   # that should be applied to documents whose root is equal to the
previous element
   # or to any document if that previous element equals a dash

   while (my $root = shift @$rootprocessors and my $stylesheet =
shift @$rootprocessors) {
     if ($root eq '-' || $root eq $xmlroot) {
       push @stylefile, $stylesheet;
     }
   }

   my $out = $input->transform(map XSLT($_), @stylefile);

   return OK, $out;
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to