Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL: how to remove nodes from the XML tree? (advanced)

From: Pavel Lepin <p.lepin@-------.--->
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent