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

RE: 'Problems getting '&' output instead of '&'.

Subject: RE: 'Problems getting '&' output instead of '&'.
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Mon, 6 Jan 2003 12:38:31 -0500
escape amp in url
[ Edward L. Knoll]

> I have a XSL stylesheet which is generating HTML targeted at 
> a old server which apparently does not recognize '&amp;', 
> because we're having problems getting  parameters passes to a 
> servlet and the only thing we've been able to come up with 
> seems to be that we have '&amp;' in the URL instead of '&'.  
> I've been though several of the old threads related to 
> disable-output-escaping and issues with ampersand and have 
> yet to find something that works.
> 

"&amp;" in a url is correct when the url is the value of an attribute.
Most html browsers however tolerate a plain "&" there, even though it is
not correct (since it is a common mistake).  

However, "&amp;" is not correct when the url is actually used to find a
network address.  The browser takes care of converting the entity to the
actual character value (which in this case is "&").  So your server
should not be seeing any "&amp;" entities in requests.

So there should not be any need to escape the "&amp;" in your output,
but perhaps you are doing something that would better be done in some
other way.  Could you explain more about the problem you say your server
is encountering?

> I suspect my initial problem is that I have variables which 
> represent common content which is output multiple times 
> during processing.  Part of this common content are these 
> URLs.  Given what I've read, the reason I'm not successful in 
> the 'disable-output-escaping' is because the variable 
> represents a results-tree-fragment and the 
> disable-output-escaping won't work unless I was "serializing 
> to output". 

See, you cannot have a bare "&" in the xml or html anywhere, whether in
the source, the stylesheet, or the output (unless it is text output).
Internally, the processor stores "&" in place of "&amp;", so all the
strings are stored as intended and it is just a matter of getting the
output you intend to get.

Cheers,

Tom P

 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.