RE: [xsl] unwanted xmlns="" attribute

Subject: RE: [xsl] unwanted xmlns="" attribute
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 4 Oct 2004 10:55:26 +0100
> From an idealogical perspective it may very well be 
> unconventional to do 
> this, I'm trying to define a generic XSLT library that can be 
> imported 
> across all Syndication formats. RSS 0.91 is not namespace 
> qualified whereas 
> 1.0 is.
> Generally the imported modules mean the same things though 
> they do not have 
> to, any thoughts?

Yes, I forgot that oddity of RSS. I would propose using a pipeline approach:
if you find RSS 0.91, first do a transform step that adds the namespaces,
then the rest of the transformation can be written on the basis that the
namespaces are there. A series of simple transformations is generally better
than a complex one that tries to handle everything at once.

A transformation to add namespaces is a simple variant of the identity

<xsl:template match="*">
 <xsl:element name="{local-name()}" namespace="...">
  <xsl:copy-of select="@*"/>

Michael Kay

Current Thread