Subject: RE: [xsl] how to exclude namespaces from copy-of From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Thu, 5 Nov 2009 15:26:57 -0000 |
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: [xsl] 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.
Current Thread |
---|
<- Previous | Index | Next -> |
---|---|---|
[xsl] how to exclude namespaces fro, cert21 | Thread | Re: [xsl] how to exclude namespaces, cert21 |
[xsl] how to exclude namespaces fro, cert21 | Date | Re: [xsl] how to exclude namespaces, cert21 |
Month |