web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AIF outbound port, transform is removing all white spaces from the text file

(0) ShareShare
ReportReport
Posted on by 86

Good day all 

We have created an outbound port in Dynamics Ax 2012 R3 to send financial data to an external system. We are using a file system adapter to insert the file into a test directory at the moment. I have written an outbound transform (XSL) to transform the XML generated by the document service to a text file. We are required to produce a TSV (tab separated value) file. The data is being extracted from Ax correctly BUT in the text file produced, all white spaces (tabs and spaces between values) have been removed even though they show properly when I test the transform in Visual Studio or Internet Explorer. I will post a sample xml file and the xsl below. Any advice regarding how to prevent these spaces from being ignored/removed would be greatly appreciated. 

Thanks in advance

Stephen

XML sample:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="testXSL.xsl"?>
<Envelope xmlns="schemas.microsoft.com/.../Message">
	<Header>
		<MessageId>{3AB26E75-E4DA-4B42-B708-359A9057272F}</MessageId>
		<Action>tempuri.org/.../find&lt;/Action>
	</Header>
	<Body>
		<MessageParts xmlns="schemas.microsoft.com/.../Message">
			<IMXAifI060 xmlns="schemas.microsoft.com/.../IMXAifI060">
				<DocPurpose>Original</DocPurpose>
				<SenderId>sam</SenderId>
				<CustInvoiceJour class="entity">
					<_DocumentHash>038f6e2051a3b77986cbba07ed1a3b7e</_DocumentHash>
					<CustGroup>Default</CustGroup>
					<InvoiceAccount>SAM-000004</InvoiceAccount>
					<InvoiceAmount>48.00</InvoiceAmount>
					<InvoiceDate>2016-03-11</InvoiceDate>
					<InvoiceId>SAM-000047</InvoiceId>
					<InvoicingName>Heraeus</InvoicingName>
					<NetAmount>48.00</NetAmount>
					<Qty>49.000</Qty>
					<RecId>5637168644</RecId>
					<XMLDocPurpose>Original</XMLDocPurpose>
					<CustTable class="entity">
						<AccountNum>SAM-000004</AccountNum>
						<CustGroup>Default</CustGroup>
						<Name>Heraeus</Name>
						<Party>000000016</Party>
						<RecId>5637146076</RecId>
						<DirPartyTable xsi:type="AxdEntity_DirPartyTable_DirOrganization" class="entity" xmlns:xsi="www.w3.org/.../XMLSchema-instance">
							<Name>Heraeus</Name>
							<PartyNumber>000000016</PartyNumber>
							<RecId>5637149827</RecId>
						</DirPartyTable>
					</CustTable>
				</CustInvoiceJour>
			</IMXAifI060>
		</MessageParts>
	</Body>
</Envelope>


XSL sample:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="www.w3.org/.../Transform"
xmlns:i="schemas.microsoft.com/.../Message"
xmlns:j="schemas.microsoft.com/.../IMXAifI060"
xmlns:k="www.w3.org/.../XMLSchema-instance">
  <xsl:output method="text" encoding="utf-8"/>
  <xsl:variable name="tab">
    <xsl:text>&#x9;</xsl:text>
  </xsl:variable>
  <xsl:variable name="cr">
    <xsl:text>&#10;</xsl:text>
  </xsl:variable>
  <xsl:template match="/">
    <xsl:for-each select="//j:CustInvoiceJour">
      <xsl:value-of select="concat(substring(./j:InvoiceDate, 1, 4), $tab)"/>
      <xsl:value-of select="concat(./j:CustTable/j:Party, $tab)"/>
      <xsl:value-of select="concat(./j:CustTable/j:DirPartyTable/j:Name, $tab)"/>
      <xsl:value-of select="concat(./j:CustGroup, $tab)"/>
      <xsl:value-of select="concat(./j:InvoiceId, $tab)"/>
      <xsl:value-of select="concat(./j:InvoiceDate, $tab)"/>
      <xsl:value-of select="concat(./j:InvoiceAmount, $tab)"/>
      <xsl:value-of select="concat('0', $cr)"/>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi Stephen,

    did you get any solution for whitespaces for AIF xslt?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans