[xsl] Adding/Coercing a Namespace

Subject: [xsl] Adding/Coercing a Namespace
From: "Richard Lander" <rlander@xxxxxxxxxxxxx>
Date: Fri, 14 Feb 2003 09:08:40 -0800
 Morning,

I've got an interesting problem that I've never encountered before, and don't quite know how to solve in an elegant way.

I've got an XML file that maps XPaths to something else. The XPaths are namespace qualified, along the lines of 'cs:para'.

I then transform [1] that file into a transform [2]. 

In the first transform, I have something like:

<x:transform version="1.0" xmlns:cs="myNs">

Note that I'm using namespace aliasing, hense the 'x:'.

In the second transform, I naturally end up with something like:

<xslt:transform version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform"; xmlns:cs="myNs" xmlns:other="otherNs">

It includes templates such as:

<xslt:template match="cs:para">
	<other:foo/>
</xslt:template>

I'm not particularly fond of this approach. I'd like some way of coercing the myNs namespace to be added to transform 2. Other namespaces are auto-added to the second transform, as they are part of the content of the first transform. myNs is not part of the content of first transform. In fact, I'd like to use my scheme with several different namespaces, so do not want to have to mod transform 1 for each one.

I guess that I could add a fake template in an included transform that included some elements in the myNs namespace. Might that coerce the namespace in the way that I want?

Hopefully this makes sense.

Thanks,

Rich


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread