scripts and PIs

Rick Jelliffe ricko at
Fri Oct 15 08:53:32 BST 1999

 From: Marcus Carr <mrc at>

>>"Simon St.Laurent" wrote:
>> Suppose I declare a notation like:
>> and then a PI like:
>> <?ECMAScript {document.write("Hello, World!");}?>
>> It seems more reasonable in many ways than
>> <![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
> 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
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
or is it scoped to one entity or to the document (regardless of the
element)?"  In that case, it should be a PI not an element.

For elements and attributes, there is also the factor that programmers
like to process XML so that elements "push" a function (in James Clark's
terminology) while attributes are "pulled" from within that function.
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
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list