RE: [xsl] Doctype and namespaces in source/generated files

Subject: RE: [xsl] Doctype and namespaces in source/generated files
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Sat, 29 May 2004 01:51:08 +0200
> -----Original Message-----
> From: Mayo [mailto:mayo@xxxxxxx]
>
<snip />
> Anyway, adding this to the xsl:stylesheet does not insert the xmlns
> attribute into the <html> element in output (I'm copying the <html>
> element, not generating it) Now that I'm thinking about it, I could
> match on the html element, and add/remove attributes as required.
>

Of course! I had totally overlooked that you were copying them... which you
did clearly mention :(

However, creating the html root as a literal result element (or via
xsl:element), used in combination with namespace declarations and
exclude-result-prefixes on the stylesheet element, will give you a certain
control over the namespace declarations to be added/omitted.
(Don't know about the rest of you over here, but simply copying the root in
this case seems to be asking for trouble --or at least, seems to complicate
things unnecessarily...)

> (I'm not really concerted with removing them, as they do no
> harm, but it would certainly be cleaner. I'm more concerned about
> adding new ones in.)
>

Can you be a bit more specific about this? Do you mean that you introduce
new namespaces in the transform that are declared in none of the source
documents?

Again, if you create the root as a literal result element, you can add
custom namespace declarations to it by defining them on xsl:stylesheet (and
not adding their respective prefixes to the list in the
exclude-result-prefixes attribute).

A problem would seem to arise in the case you had two prefixes bound to the
same namespace URI, and you wanted to retain only one of them (?) MK, is
this correct? (might as well ask right away this time :) )


HTH!

Greetz,

Andreas

Current Thread