You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by f_Parlant <f_...@laposte.net> on 2003/09/01 22:23:10 UTC

xalan:write how-to add namespace declarations

hi,

I sent this question a week ago, and didn't get any answer, I try to
reformulate in this post.

I'm breaking a big file into parts and I need to insert my namespaces
declaration in the root element of the newly created files.

Unfortunately, xalan keeps stripping my declarations.


<xsl:template match="//cib:file">
   <xsl:apply-templates />
        <xalan:write
select="concat('myfile',position(),'.xml')">
<frag xmlns:cib="http://cib.homedns.org"> <!-- root element -->
   <xsl:apply-templates />
</frag>
   </xalan:write>
</xsl:template>

RESULT
<?xml version="1.0"?>
<frag> <!-- declaration has been stripped -->
my fragment
</frag>

-I've also tried with xsl:element (but xmlns:cib as an xml:attribute was not
a good idea)
-and with xsl:pi (got an error if I remember well)

How can I add namespace declaration to THIS ELEMENT only.

As this is my second post, don't hesitate  for any hint.
Thanks
François