I have an xml like
<xml>
<Text>
<body>
<para type="new"> This para needs to be suppress </para>
<para type="old"> This is an old para </para>
</body>
</Text>
</xml>
I want to suppress the body/para/@type=’new’ which I can do using following templete
<xsl:template match="para[@type='new']">
</xsl:template>
Having said that, I want to actually add another condition that if body does not contain any other element other then para/@type=’new’ then whole body element should be removed.
So
<xml>
<Text>
<body>
<para type="new"> This para needs to be suppress </para>
</body>
</Text>
</xml>
should return
<xml>
<Text>
</Text>
</xml>
and
<xml>
<Text>
<body>
<para type="new"> This para needs to be suppress </para>
<para type="old"> This is an old para </para>
</body>
</Text>
</xml>
should return
<xml>
<Text>
<body>
<para type="old"> This is an old para </para>
</body>
</Text>
</xml>
Any help or hint how to do that…
How about one more template: