You say "When I copy it ...", but you aren't copying it, you are creating a
new element that happens to have the same local name as the original. Use
<xsl:copy> instead, and all the namespace nodes will be copied
automatically.
Alternatively, use <xsl:copy-of select="namespace::*"/>.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Hofman, Peter [mailto:peter(_dot_)hofman(_at_)logicacmg(_dot_)com]
Sent: 08 September 2006 12:53
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Namespace missing after transform
Hi,
I have difficulties getting all necessary namespaces in the
output while performing XML to XML transformation.
The source document contains typed elements like this:
<elem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xsi:type="xs:short">30</elem>
When I copy it using the following xsl template the xmlns:xs
reference is missing.
Template:
<xsl:template match="elem">
<xsl:element name="elem">
<xsl:attribute name="xsi:type"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:value-of select="@xsi:type"/>
</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
Result:
<elem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xs:short">30</elem>
Any ideas how to fix this?
Additional information:
XSL version: 1.0
XSLT processor: not sure, I think it is SAX based. Anyway,
problem also occurs with msxsl.exe (version 4.0).
Kind regards,
Peter Hofman
This e-mail and any attachment is for authorised use by the
intended recipient(s) only. It may contain proprietary
material, confidential information and/or be subject to legal
privilege. It should not be copied, disclosed to, retained or
used by, any other party. If you are not an intended
recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--