Re: [xsl] &parameter= in XML to HTML transformation

Subject: Re: [xsl] &parameter= in XML to HTML transformation
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 31 Jan 2007 15:25:50 +0100
stephan@xxxxxxxxxx wrote:
but the &amp would stay and &amp and not render to &

While & is illegal in XML and HTML it is perfectly legal (and required) in an URL. I searched online and found:

You must have been misinformed. Legal? No. Required? Definitely not. Perhaps you meant that some browsers are tolerant about mistakes in HTML, because it is considered good practice by browser designers to "show what is likely that the html designer wanted to show, instead of showing nothing or an error".


This HTML fragment:

<a href="http://somesite.com/query?legal&no"; >I am illegal</a>

will be read correctly (but may switch on the quirks mode of your browser even if the rest is legal (X)HTML) and the link is clickable. Any HTML validator will dismiss it as containing errors.

This HTML fragment:

<a href="http://somesite.com/query?legal&amp;yes"; >I am legal</a>

will be read correctly as well, will not switch to quirks mode (instead will remain in standards mode) and all available HTML validators will show "valid html".


What makes matters worse is that many page design tools encode links incorrectly. And even some self proclaimed authorities on HTML forums claim that it is legal (or required) to code it like that. But try it out, hover your mouse over it, and you will find that you link miraculously works as if the '&amp;' were an '&'.


-- Abel

Current Thread