[PATCH] Return http status code from XSLT

Maxim Dounin mdounin at mdounin.ru
Mon Mar 11 18:20:48 UTC 2013


Hello!

On Fri, Mar 08, 2013 at 12:06:48AM +0100, SamB wrote:

> Hi,
> 
>    this patch provides simple possibility to return http error code
> from within XSLT transformation result.
>    This is simple way to quickly and correctly return i.e. 404 error
> codes instead of producing dummy soft-404 pages.
> 
> Sample XSLT:
> <xsl:template match="/">
> <html xmlns:http="http://www.w3.org/http" status="400">
>         <xsl:copy-of select="."/>
> </html>
> </xsl:template>

While an ability to alter status code returned is intresting, I 
don't think it should be done this way, abusing output attributes.  
I would rather think of something like an XSLT variable with a 
predefined name queried after a transformation.

-- 
Maxim Dounin
http://nginx.org/en/donation.html



More information about the nginx-devel mailing list