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

RE: how to remove xmlns attributes in html out put via

Subject: RE: how to remove xmlns attributes in html out put via copy-of
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 10 Dec 2004 15:45:03 -0000
remove xmlns
Sorry, I should have read a little more carefully - the namespace comes from
the source document, not from the stylesheet.

xsl:copy-of does an exact copy. If you want to change the names of the
elements in the source document (by changing their namespace), you can't use
xsl:copy-of, you need to transform the source using a variant of the
identity template:

<xsl:template match="*" mode="copy-sans-namespace">
<xsl:element name="{local-name()}" namespace="">
  <xsl:copy-of select="@*"/>
  <xsl:apply-templates mode="copy-sans-namespace"/>
</xsl:element>
</xsl:template>

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

> -----Original Message-----
> From: Jan Limpens [mailto:jan.limpens@xxxxxxxxx] 
> Sent: 10 December 2004 14:46
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  how to remove xmlns attributes in html out put 
> via copy-of
> 
> hi,
> 
> in my xml I have xhtml markup such as this:
> 
> <Document xmlns="http://limpens.com/entry">
> <Para>The solution came in the form of <a
> href="http://authors.aspalliance.com/PaulWilson/Articles/?id=1
> 4">Wilson's
> Master pages</a>.</Para>
> </Document>
> 
> my xslt tries to convert this to valid xml
> 	<xsl:template match="entry:Para">
> 		<p>
> 			<xsl:copy-of select="node()" />
> 		</p>
> 	</xsl:template>
> 
> but produces xmlns attributes in the xhtml tags, such as...
> <p>The solution came in the form of <a
> href="http://authors.aspalliance.com/PaulWilson/Articles/?id=14"
> xmlns="http://limpens.com/entry">Wilson's Master pages</a>.</p>
> 
> wheather this is correct behaviour or not, I don't like the added
> namespace in the anchor element too much, because it breaks my
> otherwise valid xhtml.
> 
> I am using the .net (version 1.0) processor.
> I tried to look it up in the archives and the faq, but didn't find
> anything useful (whereas I am quite positive my question has already
> been answered numeous times), so I hope nobody minds.
> 
> Thanks in advance!
> -- 
> Jan
> http://www.limpens.com
> 
> Otakoo Saloon Cartoon - newest episode at 
> http://limpens.com/oscredirect

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.