Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: XSL: how to remove nodes from the XML tree? (advanced) [Thread Next] Re: XSL: how to remove nodes from the XML tree? (advanced)To: NULL Date: 5/2/2007 10:00:00 AM M <m@m...> wrote in <1tpYh.1549$u92.652@n...>: > "roy axenov" <r_axenov@m...> wrote in message > news:f0qpcn$i5h$1@a...... >> pavel.repkin@g... wrote: >> > Suppose, there is a special kind of node you want to >> > remove. Let it have "bad" name. Each "bad" node has a >> > parent node, obviously. In case there are no children >> > left in the parent after removal of all the "bad" >> > nodes, the parent must also be removed. And this rule >> > is applied to all the ancetors of the "bad" node >> > recursively. >> >> > xsltproc bad.xsl bad.xml >> <?xml version="1.0"?> >> <a> >> >> >> <e/> >> </a> >> > >> >> Yep. It even seems to work on your sample document. > > I think the empty template needs to be... > <xsl:template match="*[descendant-or-self::bad and > parent::*]"/> That would remove any element that has any <bad/> descendants. I don't believe that's what the OP was asking for. -- Pavel Lepin | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
