Hi i need to convert the xml to xml

inut xml is

<associds>
    <associd>
    <associdentifierValue>12345</associdentifierValue>
    <associdtype>AAA</associdtype>
    </associd>
    <associd>
    <associdentifierValue>24688</associdentifierValue>
    <associdtype>BBB</associdtype>
    </associd>
  </associds>

expected out is if child element value is BBB - i need to remove the whole element in associd.

<associds>
    <associd>
    <associdentifierValue>12345</associdentifierValue>
    <associdtype>AAA</associdtype>
    </associd>
     </associds>

XSLT is given below, but it is removing only associdtype is BBB , i need to remove entire parent. i need as soon as possible.. Thanks in advance.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:dp="http://www.datapower.com/extensions"
        extension-element-prefixes="dp"
        exclude-result-prefixes="dp">
 
        <xsl:output method="xml"/>
 
       <!-- Confidential#1 access-denied fields-->
 
        <xsl:template match="associdtype[.='BBB']">
  </xsl:template>
  <!--  Rest of the response fields are allowed to pass from service output -->
 
    <xsl:template match="@*|node()">
      <xsl:copy>
         <xsl:apply-templates select="@*|node()" />
      </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

Good try. You're pretty close. Try this one.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="@*|node()">
		<xsl:copy>
			<xsl:apply-templates select="@*|node()"/>
		</xsl:copy>
	</xsl:template>

	<xsl:template match="associd[associdtype = 'BBB']" />

</xsl:stylesheet>

Produces the output

<associds>
	<associd>
		<associdentifierValue>12345</associdentifierValue>
		<associdtype>AAA</associdtype>
	</associd>
</associds>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.