Hi,
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
...
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">
Here you don't bind a URI to the default namespace
<xsl:variable name="rss_rdf_resource_image"> <xsl:element
name="image"> <xsl:attribute
Thus here the image element is created in null namespace
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/"
Here you define the default namespace to be bound to a URI
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"/>
And here you copy the image element in null namespace, thus forcing the
serializer to undeclare the default namespace declatation to output what you
want.
Declare all the namespaces in the xsl:stylesheet element and it will work like
a charm.
Cheers,
Jarno
--~------------------------------------------------------------------
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>
--~--