Re: [xsl] XML source with DOCTYPE declaration

Subject: Re: [xsl] XML source with DOCTYPE declaration
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Fri, 20 Apr 2001 14:47:55 +0100
Hi Zeljko,

> But then I do not understand why it is necessary to add the
> namespace to every (X)HTML element/tag as it is being done?

It might be there to 'help' because it means you could include the DTD
and use one of the subelements (like just a 'div' or something), and
it will automatically declare the namespace for that element (and its

> To be precise I am using the DTD from XHTML Basic 1.0. It's DOCTYPE
> declaration looks like this:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
> "";>

Oh, it's probably that the DTDs that I have aren't the ones from the
XHTML modularisation initiative.

> Well, when I place a <xsl:cop-of/> at the template matching the root
> element ("/"), I receive the following output:
> I'm using Xalan J 2.0.0 as XSLT processor.
> Any hints how to deactive this??

Yes - get Xalan J 2.0.1.  Looking at the release notes, it's a bug
that Xalan J 2.0.0 used to access the comments in the DTD in that way,
that's been fixed now.

> Is there a possibilty to check in the XSLT stylesheet which or how
> many namespaces are declare/used in the XML file which is being
> transformed?

Yup. You can access namespace nodes for a particular element to tell
you what namespaces are 'in scope' (have been declared) for that
element. The name of these namespace nodes gives the prefix that's
been used in the source XML; the *value* of the namespace nodes gives
the namespace URI that they've been declared with. So for example, if
you do:

  <xsl:for-each select="/*/namespace::*">
     Prefix: <xsl:value-of select="name()" />
     URI: <xsl:value-of select="." />

Then you should be able to see what namespaces have been declared.
I hope that helps,


Jeni Tennison

 XSL-List info and archive:

Current Thread