brian m. carlson brian m. carlson Code version 2 of the GNU General Public License the Creative Commons Attribution-ShareAlike 3.0 License

Among other projects that I’m working on right now, I have my own set of XSLT stylesheets that basically do some fixup on top of the DocBook XSL-NS stylesheets. One of the other things that these stylesheets do is turn DocBook 5 into Atom 1.0. As a good producer of Atom 1.0, I try to check the Atom output that I create with the Feed Validator. It produces some recommendations on occasion, and I try to make it happy.

One thing that it noticed is that my Atom ends up with an xmlns:xsi namespace attribute. This occurs because when the XHTML is XIncluded into the Atom feed, it dereferences all of the DTD, and this namespace node ends up being emitted. The postprocessing stylesheet drags this namespace node along with an xsl:copy tag.

I didn’t used to have this problem when I used tools built on libxslt1.1, but I have recently learned that the behavior of stripping unneeded namespace nodes is actually a bug. So now that I use Java tools, I actually get correct behavior. Which isn’t what I really want.

So I’m now trying to generate all the namespace nodes I’m going to need on the root element and then process out the excess nodes only on the elements that end up with them. Unfortunately, that means that all of the XHTML elements, since they all end up with that namespace node. Fortunately, this won’t occur in XHTML 5, since it doesn’t use a DTD, and therefore won’t pull in those extra namespace nodes.