[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: how to exclude namespaces from copy-of
Thank you. That makes sense. I took your advice and created this template <xsl:template match="*" mode="fragment"> <xsl:element name="{local-name()}"> <xsl:value-of select="." /> <xsl:apply-templates select="*" mode="fragment" /> </xsl:element> </xsl:template> Now from another template that processes the atom feed item I call it like this: <xsl:when test="@type='xhtml' or @type = 'application/xhtml+xml'"> <fragment> <xsl:apply-templates mode="fragment" select="xhtml:div" /> </fragment> </xsl:when> <xsl:when test="@type='html' or @type = 'text/html'"> <xsl:value-of select="." /> </xsl:when> <xsl:otherwise> <xsl:value-of select="normalize-space()" /> </xsl:otherwise> IT works well now! Michael Kay wrote: 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
|
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
|