Re: [xml-dev] Namespaces in XML and schemas

Ron,

Thank you very much for your answer.
I need a little time to think about it and I will further comment afterwards


Regards,

L.

-------Original Message-------

From: Ronald Bourret
Date: Thursday, January 31, 2002 12:11:00 AM
To: Laurent Therond
Cc: xml-dev@lists.xml.org; xmlschema-dev@w3.org
Subject: Re: [xml-dev] Namespaces in XML and schemas

Laurent Therond wrote:

> This could be a stupid question,

It definitely isn't.

> "Namespaces in XML" states:
> 
<snip />

> Hence, in accordance with the specification of namespaces, the following
> document (a stylesheet fragment) is said to be valid (I am not sure if
> "valid" applies here, in fact.):

I think you are confusing three different things:

1) Conformance to the namespaces spec. The following document conforms
to the namespaces spec.

2) Validity. Technically, this means that a document is valid according
to a DTD. The following document is not valid because it does not
contain a DTD, so validity can't be checked. You could write a DTD for
this specific document, but there is no reason to do so, as it wouldn't
apply to other similar (but different) XSLT documents. It is impossible
to write a DTD that applies to all XSLT documents, since XSLT documents
can contain arbitrary elements.

3) Schema validity. This means that a document is valid according to an
XML Schema. It is (theoretically) possible to schema-validate only part
of a document. It is also possible to "laxly" schema-validate documents
or skip parts of documents altogether during schema validation. These
might be useful for validating XSLT stylesheets (see below).

Other schema languages have similar types of validity. The rules vary
according to the language.

An interesting question here is whether it is possible to write:

a) A schema (any language) to validate the XSLT parts of an XSLT
document,

b) A schema (any language) to validate the non-XSLT parts of an XSLT
document for a given output type (e.g. the output of the XSLT schema
must be XHTML).

Any takers?

<snip text="XSLT document" />

> Now, this is swell and all but an assumed schema for XHTML would not allow
> the "xsl:value-of" element as part of the content of the "title" element.

Correct. 

> Therefore, my questions are:
> 
> 1) Are stylesheets supposed to be valid documents?

No. See above.

> 2) How can one consider the possibility of multischema documents, granted
> that 2 schemas can conflict with each other?

Depends what you mean by multi-schema documents:

1) A document, all of which conforms to more than one schema. Although
it is possible to write an infinite number of schemas that apply to a
single document, it would be very rare to do so.

2) A document, parts of which conform to different schemas. This is more
common, although still a minority. XML Schemas allows you to define such
schemas to a certain extent. When you get to the part of the document
outside the current schema, you simply say, "Anything can go here."
(This works for children. Does XML Schemas have a way to say, "I can
have any parent, but I must conform to the following schema?")

3) A document whose schema has elements/attributes from more than one
namespace. This is the most common case and is supported by all schema
languages. Namespaces are used to resolve collisions between local
names.

> Finally, I am asking these questions because I would like to define the
> schema of a minimal language that I would use to create document templates

> Among other things, this minimal language would involve elements that are
> not allowed as part of the content of certain XHTML (for instance)
> elements, but that must exists as such to provided the desired templating
> functionality.

The short answer is that you won't be able to use the XHTML schema (for
example) to validate such documents. Whether it is possible to use the
XHTML schema to partially validate such documents probably depends on
how you want to use XHTML.

-- Ron

.

Received on Thursday, 31 January 2002 09:53:30 UTC