Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - XSLT to Remove Elements with Specific Attributes? >Thread Next - Re: XSLT to Remove Elements with Specific Attributes? Re: XSLT to Remove Elements with Specific Attributes?To: NULL Date: 2/6/2009 12:32:00 PM Aaron Davies wrote: > I'm new to XSLT, and thought I'd start off with (what I hoped was) a > fairly simple transform, but I can't make heads or tails of the > example code I've found around the web. I'd like to a transform that > copies input to output, except that elements of a specific type with > attributes with specific values (and all their content) are omitted > completely. An example would be processing XHTML and dropping all P > paragraphs with class="foo". I assume this is fairly easily derivable > from an identity filter, but I'm not sure where to start. Any help > would be much appreciated. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0"> <xsl:template match="xhtml:p[@class = 'foo']"/> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> -- Martin Honnen http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
