cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert new line break in XSLT mapping

former_member182412
Active Contributor
0 Kudos

Hi experts,

I am doing file to mail scenario, i am sending the text file as an attachment using reciever mail adapter.

I did everything, i can able to send the mail with text file attachment, but with in the file i got multiple rows, i need to put line break in XSLT mapping.

I did use following statement but it is inserting small rectangle between the records, the records are not separating with new lines, all are in one line.

<xsl:text>*#xA;</xsl:text>

note: in real coding replace * with &

Can anyone suggest me how to insert new line in XSLT mapping.

My XSLT mapping as look like:

<?xml version='1.0'?>

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

xmlns:ns0="http://www.Coj.co.za/SapIsuToABSA/DirectDebitFile">

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

<xsl:variable name="break">&lt;br/&gt;</xsl:variable>

<xsl:variable name="space"> </xsl:variable>

<xsl:variable name="newline"><xsl:text></xsl:text></xsl:variable>

<xsl:template match="/">

<ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">

<Subject>Please Check Attached Direct Debit File</Subject>

<From>S@za</From>

<To>P@za</To>

<Content_Type>text/plain</Content_Type>

<Content>

<xsl:for-each select="MT_SapIsuToABSA_DirectDebitFile/DirectDebitRec/Body">

<xsl:value-of select="Space1"/>

<xsl:value-of select="Cust_AccNo"/>

<xsl:value-of select="Reserve_1"/>

<xsl:value-of select="Cust_Name"/>

<xsl:value-of select="Cust_Name1"/>

<xsl:value-of select="Cust_Bank_AccNo"/>

<xsl:value-of select="Space2"/>

<xsl:value-of select="Cust_Bank_BranchNo"/>

<xsl:value-of select="Reserve_2"/>

<xsl:value-of select="Space3"/>

<xsl:value-of select="Cust_AccNo_1"/>

<xsl:value-of select="Space4"/>

<xsl:value-of select="Reserve_3"/>

<xsl:value-of select="Deduction_Amnt"/>

<xsl:value-of select="Space5"/>

<xsl:value-of select="Reserve_4"/>

<xsl:value-of select="Space6"/>

<xsl:value-of select="Action_Date"/>

<xsl:value-of select="Space7"/>

<xsl:value-of select="Reserve_5"/>

<xsl:text>*#xA;</xsl:text>

note: in real coding replace * with &

</xsl:for-each>

</Content>

</ns1:Mail>

</xsl:template>

</xsl:stylesheet>

Kind regards,

Praveen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Plz try this (instead of <xsl:text>*#xA;</xsl:text> use below statement):

<xsl:value-of select="$newline"/>

Thanks

Amit

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Praveen,

Did you try using <xsl:variable name="UC13" select="'&#13'"/> or <xsl:variable name="UC10" select="'&#10'"/>

?

Regards,

Gautam Purohit

Former Member
0 Kudos

Hi,

I think <xsl:text>#xa;</xsl:text> should do the trick, but depending on which OS (ux or win), the "new line" chars sequence is different (win would require a CRLF like <xsl:text>#xd;*#xa;</xsl:text>)

Chris

  • -> &

Edited by: Christophe PFERTZEL on Apr 14, 2010 2:16 PM

former_member182412
Active Contributor
0 Kudos

Hi

I want to do fixed length text file as an attachment, so can anyone please let me know is it possible to do it XSLT mapping, if yes please suggest me how can i do it.

Kind Regards,

Praveen.