[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: namespaces and xmlns=""

Subject: RE: namespaces and xmlns=""
From: <Jarno.Elovirta@xxxxxxxxx>
Date: Tue, 29 Nov 2005 13:13:53 +0200
xmlns image
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.