Re: [xsl] namespaces and xmlns=""

Subject: Re: [xsl] namespaces and xmlns=""
From: George Cristian Bina <george@xxxxxxxxxxxxx>
Date: Tue, 29 Nov 2005 13:17:44 +0200
Hi,

Because you have a default namespace different from no namespace and in this context you output an image element from no namespace. In order to have that the default namespace must be (re)set to no namespace.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


tom tom wrote:
Hi all, can someone explain why the following XML and XSLT produces an xmlns="" attribute on the image tag in the output. I am using MSXML4

XML:
<root/>

XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:local="#local-functions" xmlns:s="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; xmlns:dc="http://purl.org/dc/elements/1.1/"; exclude-result-prefixes="msxsl local s dt rdf">


<xsl:variable name="rss_rdf_resource_image">
<xsl:element name="image">
<xsl:attribute name="rdf:resource">/images/logo042.gif</xsl:attribute>
</xsl:element>
</xsl:variable>
    <!--

-->
<xsl:template match="root">
<rdf:RDF xmlns="http://purl.org/rss/1.0/"; xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:image="http://purl.org/rss/1.0/modules/image/";>
<channel rdf:about="http://about.about.com/";>
<title>Recently Edited Articles</title>
<link>http://about.about.com/dfgdsf</link>
<description>Recently Edited Articles</description>
<dc:date>2005-11-29T10:16+03:00</dc:date>
<xsl:copy-of select="$rss_rdf_resource_image"/>
</channel>
</rdf:RDF>
</xsl:template>
</xsl:stylesheet>


Output:

<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns="http://purl.org/rss/1.0/"; xmlns:image="http://purl.org/rss/1.0/modules/image/"; xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
<channel rdf:about="http://about.about.com/";>
<title>Recently Edited Articles</title>
<link>http://about.about.com/dfgdsf</link>
<description>Recently Edited Articles</description>
<dc:date>2005-11-29T10:16+03:00</dc:date>
<image rdf:resource="/images/logo042.gif" xmlns=""/>
</channel>
</rdf:RDF>


_________________________________________________________________
MSN Messenger 7.5 is now out. Download it for FREE here. http://messenger.msn.co.uk

Current Thread