Forum: NGINX XSLT, one XML file and differing URIs

2974d09ac2541e892966b762aad84943?d=identicon&s=25 dvdnginx (Guest)
on 2014-03-19 11:48
(Received via mailing list)
Hello,

 I was wondering if anyone could put on the right path to do the
following,

So in it's simplest form, lets say I have one file "chapter.xml" in
directory A

/A/chapter.xml

I want to use nginx XSLT processing ability to "present" this file based
on
different URIs, so

If someone accesses /A/ it presents chapter.xml using XSLT file
chapter.xsl,
if someone accesses  /A/sec1/ it presents chapter.xml using XSLT file
sec.xsl and passes it parameter 1, if someone accesses /A/sec2/ it
presents
chapter.xml using XSLT file sec.xsl and passes it parameter 2.

etc.

I can achieve the first one as follows

  location /A/ {;
          xslt_stylesheet chapter.xsl;
          index  chapter.xml
        }

but I'm stuck on /A/sec1 /A/sec2 etc

Thanks,

 Dave

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,248495,248495#msg-248495
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2014-03-19 15:08
(Received via mailing list)
Hello!

On Wed, Mar 19, 2014 at 06:48:25AM -0400, dvdnginx wrote:

> different URIs, so
>   location /A/ {;
>           xslt_stylesheet chapter.xsl;
>           index  chapter.xml
>         }
>
> but I'm stuck on /A/sec1 /A/sec2 etc

The "alias" directive should do the trick, see
http://nginx.org/r/alias.

Something like this should work:

    location /A/ {
        xslt_stylesheet chapter.xsl;
        ...
    }

    location /A/sec1/ {
        alias /path/to/A/;
        xslt_stylesheet sec.xsl;
        ...
    }

--
Maxim Dounin
http://nginx.org/
2974d09ac2541e892966b762aad84943?d=identicon&s=25 dvdnginx (Guest)
on 2014-04-03 13:04
(Received via mailing list)
Hi Martin,

 Thanks I' look into it, sorry about delay in replying I got side
tracked!

 Cheers,

 Dave.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,248495,248954#msg-248954
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.