[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Valid XML document

  • From: "Didier PH Martin" <martind@n...>
  • To: "'XML Dev'" <xml-dev@i...>
  • Date: Wed, 24 Nov 1999 13:51:31 -0500

valid xsl
Hi Steve

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
recommendation's quality.

Didier PH Martin

Steve said:
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>
        <!ATTLIST xsl:stylesheet
                version CDATA #REQUIRED
                xmlns:xsl CDATA #REQUIRED
                id ID #REQUIRED>
        <!ATTLIST xsl:value-of
                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:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.