Solved

XML Line Breaks

Posted on 2007-04-02
2
2,009 Views
Last Modified: 2013-11-19
New at xml and XSLT but I have manage to get reference the xslt file with the xml file..  Now I have another question.. one of my nodes in the xml file contains a sentence that should have line breaks but I don't know how to add them.  The line displayed in my browser goes across the screen.
0
Comment
Question by:moralju
2 Comments
 
LVL 12

Accepted Solution

by:
StuFox100 earned 250 total points
ID: 18841195
Assuming you have the line breaks in the XML file, I think you want this:
<xsl:preserve-space elements="list-of-element-names"/>
A useful site to help develop your skills is http://www.w3schools.com/
Cheers
Stu
0
 
LVL 60

Assisted Solution

by:Geert Bormans
Geert Bormans earned 250 total points
ID: 18841560
preserve-space will not work in a browser.

I assume you are transforming to (X)HTML.
If you do, you could put the part of the XML that requires preserving the spaces in a <pre> tag.
This is preformatted text and will keep the whitespace and show it in the browser

If you want to force a newline in a browser, you will need to add a <br />

You can force the HTML to wrap lines and not go outside your browser window by adding a CSS property "wrap"

various possibilities, depending on what you need

cheers

Geert
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
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)

828 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