Re: [dssslist] & as string

Subject: Re: [dssslist] & as string
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 15 Sep 2006 10:20:17 +0100
> Why (string-append "&#43;" "Hello" "&#43;") gives "+Hello+" as output,
> and (string-append "&#38;" "Hello" "&#38;") gives "&#38;Hello&#38;" as 
> output, instead of "&Hello&"?

In XML and HTML (and most of the time in SGML)  an & in element or
attribute content can only be used as an entity reference if &Hello& was
output as &Hello& then the SGML/XML/HTML parser would (or should, in the
case of HTML) generate an error about an unterminated (and undefined)
entity reference &Hello; so the system automatically quotes & and <
(however they were entered) to ensure that the output refers to that
character rather than an entity reference or start of a tag.

It's been a while since I used dsssl so to be honest I can't remember if
it has a way of turning off this quoting (it probably has, somewhere:-)
but if you do, the result will definitely be an HTML syntax error so you
will be relying on your browser not reporting syntax errors, but any
HTML validator, or more generally any system using a conforming HTML
parser will reject the document.

David

Current Thread