[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] XML source with DOCTYPE declaration


Subject: Re: [xsl] XML source with DOCTYPE declaration
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 23 Apr 2001 14:04:24 +0100

At 12:57 AM 4/21/01, David wrote:

> Ah -- so the namespace _declaration_ is there in the DTD regardless of
> whether you allow for prefixes?

I lied in my last reply. Technically you could keep the default no
prefix settings but set
<!ENTITY % XHTML.xmlns "">
in a local subset,  this would add xmlns="" to everything, which would
take it all out of any namespace.

but you could just as easily set
 <!ENTITY % html.qname    "helloworld" >
which would change the name of the top level element from html to
<helloworld>

Changing namespace names is just like changing element names.
It's easy to do, but there's no reason to suppose a stylesheet that
matched the old name will match the new one.

I was thinking of something sneaky like:


<!ENTITY % XHTML.xmlns.attrib
   "xmlns   %URI.datatype; #IMPLIED
   %XLINK.xmlns.attrib;">

in the internal subset, overriding the DTD's declaration of 'xmlns' as #FIXED.

But I can see other reasons why this might get a bit complex (e.g. have to make sure the other parameter entities are also already declared, etc.), or be a bad idea for other reasons.

As for your point that "there's no reason to suppose a stylesheet that
matched the old name will match the new one", that's quite true. Problem is, the user (Zeljko) has a stylesheet that won't match the old name (i.e. the name as qualified by the DTD's namespace declaration) because it matches a corresponding local name with no namespace (since it was written for a document without the DTD). Since local names are the same, and the presence of the namespace is opaque to the user (since declared only in the DTD), it does not seem unreasonable to expect (or at least find a way for) the same stylesheet to work on either document.


So I'm trying to figure out a simple way, not to write the stylesheet to match two sets of names (although such an approach may be the best way to go in this case: I haven't decided that), but rather to provide for the names in the DTD-less and DTD-valid instances to be the same.

Another alternative approach could be, to give the well-formed instances themselves (note that observing your distinctions, David, these are *not* XHTML documents, are they?) the necessary declaration, as in

<!DOCTYPE html [
<!ATTLIST html xmlns CDATA #FIXED "http://..." >
]>
<html>...</html>

...and then replace this DOCTYPE with the standard declaration when validation is called for.

But only Zeljko can determine what the best solution is in this case.

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx 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




Current Thread
Keywords