Solved

How to create line break in xsl for text output?

Posted on 2009-07-07
5
2,061 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

756 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