3 ms·
> I never understood why there wasn't an <include> > element in HTML, that would just paste the content of > the linked document. Why wasn't such an ele
by zmix 7y ago
> I never understood why there wasn't an <include>
> element in HTML, that would just paste the content of
> the linked document. Why wasn't such an element added
> in the late 90's or early 2000?
As far as I know, for SGML (and therefore old fashioned XML, too), 'include' gets realized via parsing of external &entities;. That's how the Mozilla XUL applications (Seamonkey, Firefox, Thunderbird) etc. realized localization, for example.
I don't know, when XInclude has first been ratified (the current, 2nd revision, of the spec is from 2006), but with it, a generic inclusion mechanism exists for XML, therefore also for XHTML.
With XHTML you could (in theory, as said, the spec is there) use XInclude.
<?xml version='1.0'?>
<html xmlns="http:www.w3.org/1999/xhtml"
xmlns:xi="http://www.w3.org/2001/XInclude">
<head>
</head>
<body>
<p>120 MHz is adequate for an average home user.</p>
<xi:include href="disclaimer.xml"/>
</body>
</html>
I am not quite sure, yet, how namespace mixins are handled in XHTML, I think, one must define a new schema (which, honestly is a crappy requirement and should be abandoned), effectively creating an XHTML+XInclude document type, but that may be only a real issue for strict validation.