2009 AX getting rid of tags not needed when creating XML-files using AIF

2009 AX getting rid of tags not needed when creating XML-files using AIF

This question has suggested answer(s)


I have a button in my application which calls SendXMLOriginal to get data from Database and put it into Queue Messanger. After that a Batch Job uses XSLT-tranforming to manipulate resulting XML. Last phase is that XML data is stored into filesystem using FileAdapter,

I made a simple sample to show what I mean. The question is that how can I get rid of these Envelope, Header, Body, Endpoints etc tags because another application reads this file and it's XMLSchema and that Schema doesn't contain these Tags?


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">

XML-tags and data



<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
<MessageParts xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
<output xmlns="">

XML-tags and data




All Replies
  • Hi Mike,

    You need to add a transformation like below:

    <?xml version="1.0" encoding="UTF-8"?>

     <xsl:stylesheet version="1.0" xmlns:wt="schemas.microsoft.com/.../Message" xmlns:xsl="www.w3.org/.../Transform">

         <xsl:output version="1.0" omit-xml-declaration="no" indent="yes" encoding="UTF-8" method="xml"/>

    <!--Copy all nodes from source-->

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

    <!--Remove header, message parts, body and envelope tags-->

    <xsl:template match="wt:Envelope/wt:Header"/>-<xsl:template match="wt:Envelope/wt:Body/wt:MessageParts"><xsl:apply-templates/></xsl:template>-<xsl:template match="wt:Envelope/wt:Body"><xsl:apply-templates/></xsl:template>-<xsl:template match="wt:Envelope"><xsl:apply-templates/></xsl:template></xsl:stylesheet>

    Mukesh Hirwani


  • Hello, Thanks a lot for your answer!

    I will try it immediately tomorrow morning.

    Thanks a lot,


  • Hello Mukesh,

    Your xsl works well in outside Dynamics AX. E.g tested it with Oxygen and no problem.

    But when I configure xsl to Endpoint's Outbound pipeline to be used with AifXmlTransform and AX processes file and writes it into File System using File Adapter those tags are still there.

    Have you any ideas if I need more configuration to Outbound / XSL handling or how AX's XML handling cycle actually works.

    Best Regards,


  • Hi Mike,

    U need to add that transformation to Outbound transformations not in Outbound pipeline.

    1. Outbound port > Processing options > Transform all responses: Outbound Transformations.

    2. Outbound transformation form will open up. Click Manage Transformation will open form.

    3. Click New > Provide Name & description

    4. Click Load. Locate the XSLT file which i provided above. And save.

    5. Come back to Outbound transformation form, click New and select Transformation name.

    6. Reactive port.

    Done.. :)

    Mukesh Hirwani


  • Hello again and thanks!

    Is this Outbound transformations feature also in AX 2009... Can't find it anywhere.

    Best Regards,


  • Oh no idea in AX 2009..

    You can try n follow below article:


    Mukesh Hirwani


  • Hello,

    Found an older topic with same problem


    Clip from topic 2009

    "just checked what the pipeline-componets can do and what not.

    In a pipeline-component you have only access to the "real" Message.

    This means that you only have access to all subtags of the Bodyelement in

    the XML-Message.

    You have no access to the Header tag (and subtags) because these tag are not

    generated at the time the pipeline-component get executed.

    As a result, if need to transform the header of the message you must build

    your own adapter to transform the headerinformation.

    But please keep in mind, that you must "rebuild" or provide a valid AIF

    header for all inbound messages. If a inbound message hasn't valid

    headerinfromation, these message generates an error while AIF processing."




  • Yeah this looks great.

    We can perform same with a new adapter or u can also consider using BizTalk to apply the transformation.

    Mukesh Hirwani


  • BTW: Thanks for answering to my questions!

    Best Regards,