[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: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Sat, 24 Jan 2009 10:51:01 +0000
Re:  Avoid xmlns (namespace)
2009/1/24 J. S. Rawat <jrawat@xxxxxxxxxxxxxx>:
> 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!!!

When you use a literal result element to add an element to the result
(your <item> element) all in-scope namespaces are added to the result
(as its not possible to determine at that point if they are actually
needed)... you can strip the ones that aren't required at that point
use exclude-result-prefixes.

However, in your case the <item> element is in the xhtml namespace, so
you can't strip it using exclude-result-prefixes.

Instead you either need to either not change the default namespace, or
add xmlns="" to the <item> element.

It's unusual though, to want to exclude the default namespace... (I'm
not sure it's even allowed)



-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

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.