[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: how to exclude namespaces from copy-of
Although xsl:copy-of in XSLT 2.0 can exclude unused namespaces (copy-namespaces="no"), it can't remove declarations of namespaces that are actually in use. You don't actually want to make a copy of the data, you want to transform it by changing the names of the elements. Remember that the difference between <rss/> and <rss xmlns="xyz"/> is not just a namespace declaration - the two elements have different names. So you need to do a "renaming identity transform" along the lines <xsl:template match="*"> <xsl:element name="{local-name()}"> <xsl:apply-templates select="*"/> </xsl:element> </xsl:template> Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: cert21 [mailto:cert21@xxxxxxx] > Sent: 05 November 2009 15:13 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: how to exclude namespaces from copy-of > > Hello! > > I am trying to parse the atom feed using the xsl template. > > The item in the feed contains this element: (example) <div > xmlns="http://www.w3.org/1999/xhtml" > xmlns:dc="http://purl.org/dc/elements/1.1/" > xmlns:thr="http://purl.org/syndication/thread/1.0"> > <p> > October and November are busy months for Amazon Web > Services!</p> </div> > > I want to copy the div with all its child elements, so I use > copy-of The problem is that I don't want the > xmlns="http://www.w3.org/1999/xhtml" > or xmlns:dc or any other extra data in the div attribute > > I just want the result to be > <div> > <p> > October and November are busy months for Amazon Web > Services!</p> </div> > > How can I do this? > > Thank you.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|