Link to home
Start Free TrialLog in
Avatar of DavidO84
DavidO84Flag for Ireland

asked on

How to create line break in xsl for text output?

I want to know how to insert a line breaks in the below xsl template:

the required output format is like this:
ORDER=text|text|text
ACCOUNT=text|text|text etc....
EXTRA=text|text|text
LINE=ORDER=text|text|text
LINE=ORDER=text|text|text


------------------------------------------------------
Current format shows up like this:
ORDER=text|text|text ACCOUNT=ORDER=text|text|textEXTRA=text|text|textLINE=ORDER=text|text|textLINE=ORDER=text|text|text

Any assistance on this would be great.

<files>
        <file active="true" ftp="true" ftpdelete="true" ftppath="/webspace/httpdocs/osexp/" filename="OS%realorderid%.leo" path="/export">
            <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl">
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes" media-type="text/plain" omit-xml-declaration="yes"/>
 
       
            <xsl:template match="/">
              <xsl:for-each select="orders/order">
                <xsl:text>ACCOUNT=</xsl:text><xsl:value-of select="customer_group_code"/>
				
<xsl:text>
</xsl:text>
<xsl:text>ORDER=</xsl:text><xsl:value-of select="po_number"/><xsl:text>|</xsl:text><xsl:value-of select="created_at"/><xsl:text>|</xsl:text><xsl:text>OS</xsl:text><xsl:value-of select="increment_id"/><xsl:text>ADDRESS</xsl:text><xsl:value-of select="shipping/company"/><xsl:text>|</xsl:text><xsl:value-of select="shipping/street1"/><xsl:text>|</xsl:text><xsl:value-of select="shipping/street2"/><xsl:text>|</xsl:text><xsl:value-of select="shipping/city"/><xsl:text>|</xsl:text><xsl:value-of select="shipping/postcode"/><xsl:text>|</xsl:text><xsl:value-of select="shipping/telephone"/><xsl:text>|</xsl:text><xsl:value-of select="shipping/country_id"/><xsl:text>EXTRA=</xsl:text><xsl:value-of select="shipping/firstname"/><xsl:value-of select="shipping/lastname"/><xsl:text>|</xsl:text><xsl:value-of select="customer_email"/><xsl:for-each select="items/item"><xsl:text>LINE=</xsl:text><xsl:value-of select="qty_ordered"/><xsl:text>|</xsl:text><xsl:text>2500</xsl:text><xsl:text>|</xsl:text><xsl:value-of select="sku"/><xsl:text>|</xsl:text><xsl:value-of select="name"/><xsl:text>|</xsl:text><xsl:text>|</xsl:text><xsl:text>|</xsl:text><xsl:value-of select="price"/>
                </xsl:for-each>
<xsl:text>LINE=</xsl:text><xsl:text>1</xsl:text><xsl:text>|</xsl:text><xsl:text>1</xsl:text><xsl:text>|</xsl:text><xsl:text>KFIRELAND</xsl:text><xsl:text>|</xsl:text><xsl:text>DHL Shipping</xsl:text><xsl:text>|</xsl:text><xsl:text>|</xsl:text><xsl:text>|</xsl:text><xsl:value-of select="base_shipping_amount"/>
              </xsl:for-each>
            </xsl:template>
          </xsl:stylesheet>
        </file>
      </files>

Open in new window

Avatar of DavidO84
DavidO84
Flag of Ireland image

ASKER

I did attempt a line break using:
<xsl:text>
</xsl:text>

but no joy...
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent Gertone  worked a perfectly! I know it might be simple to you but this was a complete answer for someone who is a novice in regard to xslt creation. Thanks again!
Also just to note the i was using <xsl:text>&#13;</xsl:text> but as you mention the XSLT may go true some processing that I have overlook...anyhow the second solution <xsl:text>&#13;&#10;</xsl:text> solved my problem.