This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How do I output an ampersand?


At 12:55 2000 03 18 GMT, David Carlisle wrote:
>[someone else had written--attribution, lost]:
>> I should say that IE5 is quite happy to handle URLs of the form
>> abc.cgi?p=1&q=2 but my worry is that other browsers won't be as
>> forgiving as IE.
>
>That is not forgiving, that is correct behaviour.
>
>It is not well formed XML to have & on its own so in the xml output
>method you have to have &.

True.

>In HTML (being based on sgml rather than xml) it is legal, so in

Not true.  In both SGML and XML, entity refs in attribute values 
are expanded.  (The only difference is that an & not followed by
a namechar is not recognized as an entity ref in SGML.)

>the html output method your processor _may_ decide to output
>& as & rather than & but you have no way to control that within

No, in general, it may not.  That is not valid/correct HTML.  Sure, 
browsers will accept it, and I know it is common practice, but it is 
not HTML as defined as an application of SGML.

>XSLT. (Either & or & are valid HTML, as in SGML a & is taken as
>literal character if it isn't followed by an entity name defined in the
>current dtd.

No, this is not true.  A loose & is only allowed in SGML if it is
not followed by a name character.  If the & is followed by a namechar,
it is recognized as an entity ref, and if that entity ref is not
declared (and there is no DEFAULT entity declaration--which there
isn't in HTML), that is an error in SGML and therefore in HTML.

paul


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]