xsl-list
[Top] [All Lists]

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

2003-01-06 10:38:31
[ Edward L. Knoll]

I have a XSL stylesheet which is generating HTML targeted at 
a old server which apparently does not recognize '&', 
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 '&' 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.


"&" 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, "&" 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 "&" entities in requests.

So there should not be any need to escape the "&" 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 "&", 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