XSLT and autoindex XML output: conditionally transform XML only when it's autoindex output?

Moritz Wilhelmy mw-nginx at barfooze.de
Fri Feb 26 20:46:32 UTC 2016


On Fri, Feb 26, 2016 at 23:22:54 +0300, Sergey Budnevitch wrote:
>
> > On 26 Feb 2016, at 22:27, Moritz Wilhelmy <mw-nginx at barfooze.de> wrote:
> >
> > Hi,
> >
> > The documentation said it's possible to transform XML dirlistings into
> > XHTML in order to customize what they look like, so I did one that makes
> > them look like lighttpd's:
> > https://gist.github.com/wilhelmy/5a59b8eea26974a468c9
> >
> > This works fine, but does anybody know how I apply the XSLT only
> > to transform directory indexes but not other XML files that might be
> > around? Currently, the way this config works is that all XML files are
> > being transformed by this stylesheet.
> >
> > The config looks like this:
> > https://gist.github.com/wilhelmy/5a59b8eea26974a468c9#file-nginx-snippet-conf
>
>
> Cannot check with xslt right now, but autoindex should works with this setup:
>
>         root /opt/www;
>
>         location / {
>             try_files $uri @autoindex;
>         }
>
>         location @autoindex {
>             autoindex on;
>         }
>
> Try to add xslt and xml directives in @autoindex location.

Thanks, that seems to have done the trick. I've updated the gist to
reflect my current working config, for anyone who's curious.

Best regards,

Moritz



More information about the nginx mailing list