scripts and PIs

Rick Jelliffe ricko at allette.com.au
Fri Oct 15 08:53:32 BST 1999


 From: Marcus Carr <mrc at allette.com.au>

>>"Simon St.Laurent" wrote:
>
>> Suppose I declare a notation like:
>> <!NOTATION ECMAScript SYSTEM "http://www.ecma.ch/stand/ECMA-262.htm">
>>
>> and then a PI like:
>> <?ECMAScript {document.write("Hello, World!");}?>
>>
>> It seems more reasonable in many ways than
>> <SCRIPT LANGUAGE="JAVASCRIPT">
>> <![CDATA[
>> {document.write("Hello, World!");}
>> ]]>
>> </SCRIPT>
>>
>> Any thoughts on the subject?
>
> I prefer PIs. I don't like the idea that the currrent mechanism to
insert
> script also carries an implied structural significance - that  might
> sometimes be true, but I'd prefer to be able
> to make that decision.

I think there is a programming factor too.  Ask yourself, "Is the PI a
child of the parent element or is it an effect at that point in the
document?"
If it is not an effect for that point in the document but has been
bundled into
a section perhaps with other similar markup  (e.g. into <meta> in HTML)
then I think it should be an element.

Similarly, if you ask yourself "Does this have the same scope as an
element,
or is it scoped to one entity or to the document (regardless of the
document
element)?"  In that case, it should be a PI not an element.

For elements and attributes, there is also the factor that programmers
often
like to process XML so that elements "push" a function (in James Clark's
terminology) while attributes are "pulled" from within that function.
You
will see in CSS stylesheets that people use element rules (or class
rules) but
rarely rules base solely on the existance of an attribute.

So perhaps the following is true

                   Element   PI     Attribute
-----------------  --------  ------ ---------
Push/pull          Push      Push   Pull
effect/structure   structure effect structure

More rules could be added to provide more guidence: in particular,
whether the script was applicable to all uses of the document.
But there is no reason why even all these rules will give a clear
answer in all cases: in that case, house style will probably apply
and W3C house-style is clearly to favour elements and to
favour processing by element type (or HTML class) rather than
supporting point-based markup.

So, in the case of SCRIPT in HTML, I think it should be an element
not a PI.  There is no special processing that a PI invokes at the
point of its declaration in an HTML document.

Rick Jelliffe


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list