Re: [xslt] generating malformed XML (html) from malformed XML(xhtml)



On Thu, 2003-11-13 at 15:59, Joost Helberg wrote:

>    <A href="/all/projects/<!--#echo var="REMOTE_USER" -->">Your Projects</A>
> 

One way round this is to use a cgi script that produces the link:
<!--#exec cmd="./htmllink ${REMOTE_USER} 'Your Projects'"-->
This could be something like

#include <stdio.h>
main(int argc, char **argv)
{
    if (argc < 3 || !*argv[1]) {
        printf("internal error, htmllink with no argument\r\n");
        exit(0); /* CGI scripts should exit 0 to get the data sent */
    }

    printf("<a href='/all/projects/%s/'>%s</a>",
        argv[1] ? argv[1] : "default",
        argv[2] ? argv[2] : ""
    );
    exit(0);
}

(compile it as a C program, use at own rick etc etc)

The overhead of doing this once or twice per page is likely very low
even on a pretty busy server.

Of course, if there is any chance that users can supply values directly,
in particular if they can supply HTML fragments that might contain
server-side directives, you should disable SSI and use another approach!

I'd actually be tempted to write (or use) a simple preprocessor,
though, e.g. php, so as to be able to replace the includes with
variables, and to have well-formed XML documents on my server.

That way they can be validated locally, and edited with XHTML-specific
tools, processed by XSLT or XML Query, and so on.

As you say, an alternative is to introduce a new element - then maybe
run some kind of preprocessor again, for each page invocation.

Hope this helps a little.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
http://www.holoweb.net/~liam/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]