At 05:18 PM 5/1/2007, Mike wrote:
> <!DOCTYPE foo SYSTEM "whatever" [
> <!ATTLIST foo xml:space #IMPLIED>
> ]>
> <foo xml:space="preserve">
> ....
>
Ah yes, that lovely feature of DTDs - you can do your own thing, and still
be valid.
This isn't a problem, as long as you define "validity" accordingly.
(I.e., in a way that might nullify its practical usefulness in
pathological cases. But what technology is immune from pathology?)
By making DTDs formally optional for parsing, XML took a big step
away from SGML -- bigger than many engineers seem to have understood
at the time. If MS had done the right thing at the start and not
decided it was safe to throw away whitespace arbitrarily, this never
would have been a problem. Even apart from xml:space (which is in
essence a patch over a problem created when DTD parsing becomes
optional), DTD content models offer valuable information about which
whitespace is safe to throw away, which is why whitespace munging in
the parse phase was thinkable under SGML. (Not that the MS parser
uses this information. Its original developers seem not to have
thought about mixed content.) But in XML, the DTD is not always
there, and the decision of which whitespace is "significant" or not
becomes subject to unpredictable interactions between document
instances (which may or may not invoke DTDs) and processing
architectures (which may or may not parse them even when invoked).
This is why well-behaved XML processors do not take it upon
themselves to throw away whitespace without explicit say-so, and why
XSLT had to go beyond its purview and hope, impossibly, to dictate
upstream processor behavior: "Please don't throw away whitespace; I
can take care of it".
Cheers,
Wendell
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--