[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How do I output an ampersand?

Subject: RE: How do I output an ampersand?
From: Chris Maden <crism@xxxxxxxxxxxxx>
Date: Sat, 18 Mar 2000 16:09:45 -0800 (PST)
xsl escape 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.