HTML output method and & in URLs 2003-01-28 - By Voytenko, Dimitry
Hi Angus,
Where exactly is this happening? In the attributes HREF/SRC? If so, this behaviour is correct. Otherwise, links won't work in the browsers. There's no other way to disable escaping in attributes (&, <, etc). This behaviour is defined in the xslt specification.
If this is happening in the elements SCRIPT or STYLE this is also correct.
I'm not quite sure how exactly you were trying to validate your HTML document. HTML is not an XML, but SGML. Thus, you can't validate it against XML rules. There're a lot of differences comparing to XML. For instance, <IMG> and <BR> tags are never closed. Attributes "selected", "nowrap", etc can be output w/o value. You can find the rest in the http://www.w3.org/TR/xslt#section-HTML-Output-Method
Thanks, Dimitry
-----Original Message----- From: Angus McIntyre [mailto:angus@(protected)] Sent: Tuesday, January 28, 2003 11:20 To: xalan-j-users@(protected) Subject: HTML output method and & in URLs
I have a stylesheet processor based on Xalan and Ant which I'm using to generate HTML pages from XML. Within my pages, I have some URL strings containing arguments, separated by '&'. In the input document, the form is:
arg1=foo&arg2=bar&arg3=baz
The final HTML output contains the string
arg1=foo&arg2=bar&arg3=baz
which fails validation as HTML, because it uses '&' rather than '&'.
My stylesheet defines the output method as:
<xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd" xalan:omit-meta-tag="yes"/>
If I change the method to 'xml', the '&' entities are not converted, so it's presumably the HTML conversion process that is doing this. Setting:
xalan:use-url-escaping="no"
doesn't seem to fix the problem.
Is there any way around this, or am I going to have to hack my processor to reencode the '&' characters as entities?
Thanks
Angus -- angus@(protected) http://pobox.com/~angus
_____________________________________________________ Sector Data, LLC, is not affiliated with Sector, Inc., or SIAC
|
|