I haven't understood the detail of your problem, but the general
solution in XSLT 1.0 to adding a namespace that isn't statically known
is:
<xsl:variable name="a">
<xsl:element name="p:dummy" namespace="{$param}"/.
</xsl:variable>
<some-element>
<xsl:copy-of select="xx:node-set($a)//namespace::p"/>
</some-element>
Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
Richard Lander
Sent: 14 February 2003 17:09
To: xsl-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Adding/Coercing a Namespace
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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list