This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: How do I output an ampersand?


On Sat, 18 Mar 2000, James Lynn wrote:
> > From:  Chris Knoll
> >
> > That's funny, I wasn't aware that HTML encoding was valid in a
> > URL, i thought
> > the proper URL encoding was to use the %### convension.
> 
> Quite - I suspect IE5 is handling non-standard input rather than
> giving an error, hence my desire to actually get a real ampersand.

Not quite.  Here we go again on levels of escaping:

Some characters are meaningful in a URL.  Sometimes you want them to
really be there; sometimes you don't.  When you don't, you hex-escape
them.

For example, let's say you want to run silly.cgi with the parameters
"volt" equals "5", "amp" equals "7", and "company" equals "AT&T".  The
ampersand is meaningful to a URL, so you need to escape it as %26.

Then you string together your URL.  Some broken systems still use
ampersands to join CGI parameters, even though a semicolon has been
recommended practice since before HTML 2.0 was standardized.  So then you
have a URL of silly.cgi?volt=5&amp=7&company=AT%26T.

Now you want to put this URL into an attribute in an HTML or XML file.  
The ampersand is a meaningful character there, and since you don't want
&amp recognized as a (broken) entity reference, you must escape it,
too: <a href="silly.cgi?volt=5&amp;amp=7&amp;company=AT%26T">.

To make a long story short (too late!), the XSL implementation is correct
when it turns your output ampersands into &amp;.

-Chris



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]