Need help with xml to remove data

I have a xml. I want to remove this part (all CarrierParty) with workflow. How can I do that ?

			<CarrierParty>
				<PartyIDs>
					<ID>PREP</ID>
				</PartyIDs>
				<Name languageID="en-US">PREPAID</Name>
			</CarrierParty>

You need to use the Open XSLT task with the following code:

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

 <xsl:output omit-xml-declaration="no"/>

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

    <xsl:template match="CarrierParty"/>
</xsl:stylesheet>

EDIT: I changed the omit-xml-declaration attribute of the XSL:output element from “yes” to “no” to ensure that the resulting XML file is fully valid.

thks Phil I will try this

Phil, it does not work but I am sure I do something wrong. In the workflow, I use open xslt, then I copy your code in it. After, what do I need to do ? When I output that to c:, the CarrierParty is still there. I have never used Open xslt

Attached is a test Workflow Configuration.
It looks for an XML file in the C:\Tests\Input folder and it outputs the modified file in C:\Tests\Output .
XSLT-Sample.OL-workflow (19.4 KB)

Use the following XML data file:

<?xml version="1.0"?>
<root>
	<client>
		<lastname>Dupont</lastname>
	</client>
	<CarrierParty>
		<PartyIDs>
			<ID>PREP</ID>
		</PartyIDs>
		<Name languageID="en-US">PREPAID</Name>
	</CarrierParty>
	<client>
		<lastname>Laplace</lastname>
	</client>
</root>

Phil, it works with your file but not mine. I even tried with this
xsl:templatematch=“SyncPurchaseOrder/DataArea/PurchaseOrder/PurchaseOrderHeader/CarrierParty”/

Please post a sample file. Make sure that it doesn’t contain any sensitive data.

here is my file:
test123.xml (3.2 KB)

Phil I have found the problem. If I remove the second line of my file it works. Thks a lot

Yep, the issue is due to the namespace used by the XML. This is always a pain in the back with XSLT processes.

You can use the following code in the XSLT task instead of removing the second line of the data file:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="http://abc" exclude-result-prefixes="ns">

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

    <xsl:template match="ns:CarrierParty" />

</xsl:stylesheet>