Lists Home |
Date Index |
- From: "Didier PH Martin" <firstname.lastname@example.org>
- To: "'XML Dev'" <email@example.com>
- Date: Wed, 24 Nov 1999 13:51:31 -0500
I noticed what you are saying when I tried the small doc in a XML parser.
Sorry, I responded too fast without doing double checking on the doc.
Anyway, thanks for bringing rigor to the message.
Nevertheless the problem with validating a document composed of fragments is
still open and DTDs are not the solution like we both demonstrated ;-).
Also, we can take here the opportunity to mention that section 2.7 of the
XSLT recommendation can potentially lead to misinterpretation by including a
DTD in the example. By doing so, as Steve demonstrated so well, we would
have to include any element and attribute definition about the document.
This would include of course all our elements + the XSLT elements used. It
would be better to use as example a simple well formed document instead of a
document including a DTD. This suggestion may improve the XSLT
Didier PH Martin
You're still missing one thing for XSL to work :)
<!ATTLIST xsl:stylesheet id ID #REQUIRED>
The "#Style" fragment identifier can't find the element whose id is "Style"
it doesn't know which attributes are of type ID. Adding this ATTLIST will
the parser the needed information--it should work even for a non-validating
Regarding XML 1.0 validation, your new version is still not a "valid" XML
document--it's only well-formed. It's not sufficient to add xsl:stylesheet
the content model of <title>. You have to add separate <!ELEMENT>
for "xsl:stylesheet", "xsl:value-of", "html", "title", "body". You also have
add <!ATTLIST> definitions for all attributes that these new element types
Your DTD will be fairly large by the time you finish. If you want to embed
stylesheet in the document, you will probably want to give up being "valid",
accept being just "well-formed".
Another validity violation, not very serious but still a violation, is that
DOCTYPE element type should be "test" rather than "greeting".
For example, here's how the DOCTYPE of your document might look if you
wanted it to be completely valid--pardon my mistakes:
<!DOCTYPE test [
<!ELEMENT test (xsl:stylesheet, greeting)>
<!ELEMENT greeting (#PCDATA)>
<!ELEMENT xsl:stylesheet (html)>
<!ELEMENT html (title, body)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT body (xsl:value-of)>
<!ELEMENT xsl:value-of EMPTY>
version CDATA #REQUIRED
xmlns:xsl CDATA #REQUIRED
id ID #REQUIRED>
select CDATA #REQUIRED>
Didier PH Martin wrote:
> Didier reply:
> You are right, the id attribute is missing in the stylesheet element. So
> 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.
- Steve Dahl
xml-dev: A list for W3C XML Developers. To post, mailto:firstname.lastname@example.org
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:email@example.com the following message;
To subscribe to the digests, mailto:firstname.lastname@example.org the following message;
List coordinator, Henry Rzepa (mailto:email@example.com)