[Home] [By Thread] [By Date] [Recent Entries]
There's an easy solution to your problem. Not sure it works for XSLT 1.0
(I think it does), but at least it does so for XSLT 2.0. The idea is
simple. As you probably know, it does not matter what prefix you choose.
Now, if you choose the same namespace, but another prefix, the processor
will see it as a redefinition of the namespace and will leave it like that:
<!-- with RLE -->
<b:test xmlns:b="http://test" >
<c:test xmlns:c="http://test" />
</b:test><!-- with xsl:element --> <xsl:element name="b:test" xmlns:b="http://test"> <b:other /> <xsl:element name="c:test" xmlns:c="http://test" > <c:other /> </xsl:element> </xsl:element> Note that this won't work with using the namespace attribute of the xsl:element instruction. But because the name attribute is a QName, you can simply redefine the namespace for it. The output will look like this: <b:test xmlns:b="test">
<c:test xmlns:c="test"/>
</b:test>
<b:test xmlns:b="http://test">
<b:other/>
<c:test xmlns:c="http://test">
<c:other/>
</c:test>
</b:test>In this minimized example, your "inline" xml is under (and from) <c:test> where I redefined the namespace for which otherwise would equal the namespace of <b:test>. Well, it still does, but anyway, this should get you going. If you declare a namespace that is not used immediately, it may not appear on the 'root' element of your inline xml, but a little further on. But syntactically, in terms of XML, this should not matter. HTH Cheers, -- Abel Braaksma Benjamin Li wrote: Hi,
|

Cart



