Subject: RE : RE: root siblings contain xmlns=""
From: Florent Georges <darkman_spam@xxxxxxxx>
Date: Mon, 12 Jun 2006 12:17:58 +0200 (CEST)
|
christoph.klocker@xxxxxx wrote:
Hi
> test.xml:
> <test >
> <element1>test</element1>
> <element2>test</element2>
> </test>
> test.xsl:
> [...]
> output:
> <?xml version="1.0" encoding="UTF-8"?><Fxml xmlns="a-namespace-uri"
> Version="2_0_2">
> <element1 xmlns="">test</element1>
> <element2 xmlns="">test</element2>
> </Fxml>
> my desired output:
> <?xml version="1.0" encoding="UTF-8"?><Fxml xmlns="a-namespace-uri"
> Version="2_0_2">
> <element1>test</element1>
> <element2 >test</element2>
> </Fxml>
You are copying elements from no namespace, and want to have them in
a specific namespace. So you have to make something more than just
copy them. For example (depending on the exact semantics of your
transformation):
<xsl:template match="@*|node()" piority="0">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{local-name()}" namespace="...">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
Not tested.
Regards,
--drkm
__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicitis
http://mail.yahoo.fr Yahoo! Mail
|