Re: [xsl] RE: unwanted and non prefix namespaces in output

Subject: Re: [xsl] RE: unwanted and non prefix namespaces in output
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Sat, 31 Jul 2004 18:23:25 +0100
Hi Joel,

> Thanks, that did fix the problem. Out of curiosity (strictly
> academic as my stylesheet does what I need it to), is there a more
> elegant solution to the problem? Or is the stylesheet I wrote along
> the correct lines?

You could alternatively declare the
'http://schemas.microsoft.com/ads/2003/sequence' namespace as the
default namespace in the stylesheet (while keeping it declared with
the 'ads' prefix as well, so that you can refer to the elements in
that namespace within XPaths). If that's the default namespace in your
stylesheet, then any literal result elements that you create (without
a prefix) will be placed in that namespace.

In other words, change the <xsl:stylesheet> start tag to:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns="http://schemas.microsoft.com/ads/2003/sequence";
  xmlns:ads="http://schemas.microsoft.com/ads/2003/sequence";
  version="1.0">
 
and keep the rest of the stylesheet unchanged (from the one you
posted).

Note that you probably won't get the namespace declared on all the
<sequence> elements, since the inner ones already have the namespace
in-scope due to its declaration on the outer one.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Current Thread