Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to create line break in xsl for text output?

Posted on 2009-07-07
5
Medium Priority
?
2,070 Views
Last Modified: 2013-11-18
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

0
Comment
Question by:DavidO84
  • 3
  • 2
5 Comments
 

Author Comment

by:DavidO84
ID: 24799345
I did attempt a line break using:
<xsl:text>
</xsl:text>

but no joy...
0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 2000 total points
ID: 24799359
<xsl:text>&#10;</xsl:text>
or
<xsl:text>&#13;&#10;</xsl:text>


<xsl:text>
</xsl:text>
should work as well, but maybe your XSLT gets processed one way or another before parsing, my suggestions are safer
0
 

Author Closing Comment

by:DavidO84
ID: 31600879
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!
0
 

Author Comment

by:DavidO84
ID: 24799599
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.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24800914
welcome
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question