Solved

XML Line Breaks

Posted on 2007-04-02
2
2,003 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to file 3 67
Excel file not created as expected 7 50
Shredding xml into an oracle 11g Database 2 29
How to write an English digest paper 6 24
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.
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now