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

RE: Avoid xmlns (namespace)

Subject: RE: Avoid xmlns (namespace)
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 24 Jan 2009 19:21:57 -0000
RE:  Avoid xmlns (namespace)
An element name has two parts: the URI and the local part. Let's write it as
(uri, local). If you create an element whose name is
(http://www.w3.org/1999/xhtml, item), then the system will always generate a
namespace declaration for the namespace http://www.w3.org/1999/xhtml. When
you say you don't want this declaration, I think that what you mean is that
you don't want the name of the element to be (http://www.w3.org/1999/xhtml,
item), instead you want it to be ("", item) (that is, local name "item" in
no namespace). Since an element created using a literal result element in
the stylesheet will always have the same name as the LRE, the way to change
this is to change the name of the LRE to ("", item), which you can achieve
by writing it as

   <item xmlns="">

Always concentrate first on getting the names of the elements right. If
you've got the names right, the namespace declarations will usually look
after themselves.

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

> -----Original Message-----
> From: J. S. Rawat [mailto:jrawat@xxxxxxxxxxxxxx] 
> Sent: 24 January 2009 10:11
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx; xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Avoid xmlns (namespace)
> 
> Hi List,
> I want to avoid xmlns="http://www.w3.org/1999/xhtml" as an 
> attribute of element "item" (<itemref 
> xmlns="http://www.w3.org/1999/xhtml" 
> idref="ch1" linear="yes"/>) from the output xml even after my 
> exclusion entry in the top (#default). If I remove xmlns from 
> xsl:stylesheet, I am getting xmlns="".
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
> xmlns="http://www.w3.org/1999/xhtml"
> 	      exclude-result-prefixes="#default xsl" version="2.0">
> 
> <xsl:variable name="metafile" select="document('meta.txt')"/>
> 
> <xsl:for-each select="$metafile/items/file"> 
> <xsl:apply-templates select="." mode="manifest"/>
>   </xsl:for-each>
> 
> <xsl:template match="file" mode="manifest">
>   <item id="{title/@id}" href="{@id}" 
> media-type="application/xhtml+xml"/>
> </xsl:template>
> 
> Any tip in this direction will be highly appriciable!!!
> 
> Thanks
> ...JSR

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.