Re: What to do about newlines in attribute values?

On 13/09/2012 07:29, James Clark wrote:
> On Thu, Sep 13, 2012 at 12:07 PM, Liam R E Quin <liam@w3.org 
> <mailto:liam@w3.org>> wrote:
>
>
>     It might be better to forbid newlines in attributes.
>
>
> That's an interesting suggestion. Every option has its problems:
>
> a) allow newlines but normalizes to spaces (as XML): compatible with 
> XML, but leaves MicroXML with ugly and surprising
>
> b) disallow literal newlines: compatible with XML; users can still 
> include newlines using numeric character references; possibly better 
> error recovering when a closing quote is missing; maybe a surprising 
> limitation, but then again lots of programming languages don't allow 
> literal newlines in string literals
>
> c) allow newlines but don't normalize them: most useful behaviour but 
> incompatible with XML
>
> Currently the spec has (c), but I can see definite advantages to (b).
>
> Opinions?
>
>
There's a lot of XSLT 2.0 code around that relies heavily on newlines in 
attribute values; it would be better if they weren't turned into spaces, 
but it doesn't matter greatly that they are (the main adverse effect is 
that when you transform a stylesheet, you lose the layout). I don't know 
if this is a use case worth bothering about, but disallowing literal 
newlines reduces the set of existing XML documents that are also 
microXML documents.

Michael Kay
Saxonica

Received on Thursday, 13 September 2012 07:22:15 UTC