Valid XML document

Didier PH Martin martind at netfolder.com
Wed Nov 24 16:39:39 GMT 1999


Hi Steve,

Steve said:
It's not "valid" under XML 1.0 because you haven't included DTD definitions
for
<xsl:stylesheet>, <html>, or any of the other elements or attributes in the
stylesheet.

It shouldn't work for XSL because your DTD hasn't defined an ID attribute
for
<xsl:stylesheet>, and the <xsl:stylesheet> in this document doesn't have
"Style" as its value
of that ID attribute. So the fragment identifier "#Style" doesn't point to
anything.

Didier reply:
You are right, the id attribute is missing in the stylesheet element. So the
right document should be:
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE greeting [
>   <!ELEMENT test (xsl:stylesheet, greeting)>
>   <!ELEMENT greeting (#PCDATA)>
> ]>
> <?xml-stylesheet href="#Style" type="text/xsl"?>
> <test>
> <xsl:stylesheet version="1.0"
>                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>			id="Style">
> <html>
> <title>this is a test</title>
> <body><xsl:value-of select="//greeting"></body>
> </html>
> </xsl:stylesheet>
> <greeting>Hello, world!</greeting>
> </test>

So, the document, to be valid in accordance to the xml 1.0 recommendation,
and if we want to parse it with validation, would have to be like above.

In the SGML world we would have
> <!DOCTYPE greeting [
>   <!ELEMENT test 	- - (xsl:stylesheet, greeting)>
>   <!ELEMENT greeting 	- - (#PCDATA)>
> ]>
> <?xml version="1.0" encoding="UTF-8" ?>
> <?xml-stylesheet href="#Style" type="text/xsl"?>
> <test>
> <xsl:stylesheet version="1.0"
>                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>			id="Style">
> <html>
> <title>this is a test</title>
> <body><xsl:value-of select="//greeting"></body>
> </html>
> </xsl:stylesheet>
> <greeting>Hello, world!</greeting>
> </test>

The difference is not big except that I would need to provide a declaration
to the SGML parser so that the document could be parsed/validated.

So the actual XML 1.0 recommendation consider that the scope of validation
with a DTD is the whole document. As for SGML I cannot aggregate document
fragment with their own structure definition in order to compose an
aggregate document. "The whole has to be aware of the parts" he said with
the tone of a disappointed person. If we would have an aggregation
mechanism, the whole wouldn't need to be aware of the part and the document
could still be parsed and validated.

I guess that the XML world or the SGML world has to follow the same
evolution as procedural languages did:
a) phase 1: monolithic programs - monolithic documents
b) phase 2: modular programs - modular documents

A Possible evolution of the document specie: an object being the aggregation
of behaviors and data structure. Behaviors are stand alone fragments with
their own structure and validation process, data structure also. An object
can be composed by aggregating both. Hoops, I went too far, we're not even
at phase 2 yet. Slow down Didier :-))

Cheers
Didier PH Martin
mailto:martind at netfolder.com
http://www.netfolder.com





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