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



On Thu, Nov 13, 2003 at 09:59:19PM +0100, Joost Helberg wrote:
> ls,
> 
> I've written an XSLT-stylesheet in order to map XHTML to HTML. Most
> XHTML elements are kept intact (i.e. copied) except for HEAD and META.
> 
> The following (malformed) XHTML-code appears on the input:
> 
>    <A href="/all/projects/<!--#echo var="REMOTE_USER" -->">Your Projects</A>

This is _not_ valid XML! There's no way you will be able to convince
the XML parser (which is part of LibXML and not LibXSLT) to parse this.
While you could solve the nested quote problem by using single quotes
for the outer quoting (or vice versa, assuming Apache can handle single
quotes) you still end up with the (invalid) '<' character in the 
hre attribute.

> This uses an Apache feature called Server Side Includes. The
> expression   <!--#echo var="REMOTE_USER" -->
> is transformed by the HTTP server to the name of the authenticated
> user.
> 
> I'm not able to copy this input. As a lot of XML violations occur (<
> inside attribute value, " too). xsltproc bombs out of course.
> 
> Does any of you have a good idea on how to implement this?

Well, you _could_ write your own parser that tollerates this kind
of invalid XML but if you intend to output the same kind o stuff
you'd also have to write a serializer. Probably not worth the effort.

 hth Ralf Mattes

> I'd rather not introduce a new element (e.g. myA) which supports an
> extra attribute of some sort.
> 
> many thanks in advance,
> 
> Joost Helberg
> 
> 
> -- 
> Joost Helberg
> Snow B.V.        http://snow.nl Tel 0418-653333 Fax 0418-653666
> Voorzitter VOSN  http://www.vosn.nl Tel 0418-653336 Fax 0418-653666
> _______________________________________________
> xslt mailing list, project page http://xmlsoft.org/XSLT/
> xslt@gnome.org
> http://mail.gnome.org/mailman/listinfo/xslt



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