1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
$NetBSD: patch-ab,v 1.3 2003/05/31 14:41:32 grant Exp $
This patch incorporates a patch from the mod_xslt project page on sourceforge
in order to have a valid base URI set during xslt processing, so that document
inclusion will DTRT.
It also fixes two multi-line literals which are disallowed in gcc 3.3.
--- mod_xslt.c.orig Thu Aug 24 12:05:28 2000
+++ mod_xslt.c
@@ -43,7 +43,7 @@
#include "http_protocol.h"
#include "ap_config.h"
#include "util_uri.h"
-#include "alloc.h"
+#include "ap_alloc.h"
#include "http_core.h"
#include "sablot.h"
#include "http_log.h"
@@ -195,6 +195,8 @@ MessageHandler sablotMH = {
int transform(request_rec *r, char *styleSheetStr, char *inputStr, char **resultStr) {
int se;
+ char *cwd = NULL;
+ char *baseURI = NULL;
char *argums[] =
{
"/_stylesheet", styleSheetStr,
@@ -209,6 +211,14 @@ int transform(request_rec *r, char *styl
se = SablotCreateProcessor (&theproc);
if (cfg->debug)
se |= SablotRegHandler(theproc, HLR_MESSAGE, &sablotMH, (void*)r);
+
+ /* get current working directory */
+ cwd = ap_palloc(r->pool, MAXCHAR +1);
+ getcwd(cwd, MAXCHAR);
+
+ /* set base URI to cwd */
+ baseURI = ap_pstrcat(r->pool, "file://", cwd, "/", NULL);
+ se |= SablotSetBase(theproc, baseURI);
se |= SablotRunProcessor(theproc,"arg:/_stylesheet","arg:/_xmlinput","arg:/_output",NULL,argums);
se |= SablotGetResultArg(theproc,"arg:/_output", resultStr);
se |= SablotDestroyProcessor(theproc);
@@ -288,12 +298,12 @@ static int mod_xslt_handler(request_rec
if (!strcmp("xml",mimetype))
if (cfg->debug){
- return mod_xslt_debug_out(r, "XSLT DEBUG: \"AddHandler mod_xslt .xml\" will cause infinite
- recursion. Remove it!\n");
+ return mod_xslt_debug_out(r, "XSLT DEBUG: \"AddHandler mod_xslt .xml\" will cause infinite\n"
+ "recursion. Remove it!\n");
return ;
} else {
- ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r->server, "\"AddHandler mod_xslt .xml\" will cause infinite
- recursion. Remove it!\n");
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r->server, "\"AddHandler mod_xslt .xml\" will cause infinite\n"
+ "recursion. Remove it!\n");
return SERVER_ERROR;
}
|