I believe we cant remove the attributes as long as they exist in your document structure (DTD or Schema).But if you are creating xml string then try not to map the attributes when attribute value is null.If the xml is passed to you by other source then as a crude solution you can using with replace service?? map xmldata to replace string and specify search criteria and replace with nothing.