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

RE: Unwanted xmlns attribute appearing

Subject: RE: Unwanted xmlns attribute appearing
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 26 Apr 2006 20:16:18 +0100
unwanted xmlns attribute
Think of <item>...</item> as an instruction to create an element with a
particular name. The name has two parts: a namespace URI and a local part.
Both of these are copied from the name of the element in the stylesheet. So
your new element has namespace URI = "" and local name = "item". 

But its parent in the result tree has a different namespace URI. So to
ensure that the item element is in the right namespace (the "null"
namespace, in this case) the serializer has to generate a namespace
declaration.

You probably wanted <item> to be in the same namespace as its parent in the
result tree. To get it in that namespace, you have to put it there, which
you do by means of namespace declarations in the stylesheet.

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Karine Delvare [mailto:kdelvare@xxxxxxxxx] 
> Sent: 26 April 2006 19:44
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Unwanted xmlns attribute appearing
> 
> Hello,
> 
>    I am generating RSS feeds from an HTML file. With Perl, 
> until I finally realized XSLT would be a much better 
> solution. I decided to create a new XML file, and to have 
> seceral XSL stylesheets, one to produce the HTML file and the 
> others to produce the RSS files. First question: was that stupid?
> 
>    The XML file is currently looking like this: 
> http://edhel.gimp.org/devnews.xml
>    I managed to write the XSL to produce HTML: 
> http://edhel.gimp.org/devnews.xsl produces 
> http://edhel.gimp.org/devnews.html
> 
>    Now I'm struggling with the RSS1.0 feed. 
> http://edhel.gimp.org/devnews-rss1.xsl produces 
> http://edhel.gimp.org/devnews-rss1.xml
>    The <item> markup gets a xmlns="" attribute, and I don't 
> know where that comes from.
> 
> <xsl:template match="week">
>   <item>
>     <xsl:attribute 
> name="rdf:about">http://edhel.gimp.org/devnews.html#<xsl:value
> -of 
> select="normalize-space(parent::year/text())"/>-<xsl:value-of 
> select="normalize-space(text())"/></xsl:attribute>
>     [...]
>   </item>
> </xsl:template>
> 
> produces:
> 
> <item xmlns="" rdf:about="http://edhel.gimp.org/devnews.html#2006-17">
> 
>    So, second question: what did I miss there?
> 
>    Thanks,
> Karine

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-2007 All Rights Reserved.