Re: namespace declarations

Subject: Re: namespace declarations
From: Mike Brown <mike@xxxxxxxx>
Date: Tue, 6 Jun 2000 12:05:53 -0600 (MDT)
> I saw this in one of the previous posts:
> <?xml version="1.0" encoding="UTF-8"?>
> <?xml-stylesheet type="text/xsl" href="test.xsl"?>
> Can someone explain or recommend some easy to read info on namespaces?

The XML Namespaces FAQ at
can be helpful. Actually, once I understood the XML spec, reading the
Namespaces in XML spec wasn't too difficult :)

> In my .xsl file I've been using
> <?xml:stylesheet ... instead of <?xml-stylesheet...

Actually this isn't quite a namespace issue at all because namespaces
don't apply to processing instructions. 

Anyway, the official word is to use the hyphenated version. See:

Associating Style Sheets with XML documents

It should also be noted that "text/xsl" is *not* used as an example in
the recommendation, nor in any of the previous drafts. Only CSS examples
are given. "text/xsl" came about, I believe, from this document: and other
examples in the MS site that, perhaps not illogically for the time they
were written, assume that "text/xsl" is appropriate.

The current draft for XML media types recommends "application/xslt+xml"
for XSLT documents that are intended to be processed, and "text/xslt+xml"
for those intended to just be viewed. See for that.
However, this media type proposal is as-yet unimplemented, as far as I
know, so keep that in mind.

> Does it matter which one?

Well, a processing instruction is an instruction for an XML processor,
and thus you are going to be constrained to what the target processor
will recognize. The answer to your question depends on which one works
for you.

> And can I combine the two lines
> (<?xml version... and <?xml-stylesheet..)
> together?

I would try to use the correct one, and if that doesn't work, the
incorrect one. Not both.

   - Mike
Mike J. Brown, software engineer at         My XML/XSL resources: in Denver, Colorado, USA 

 XSL-List info and archive:

Current Thread