Solved

XML Line Breaks

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Test ddwrt:UserLookup 1 65
Insert Powershell variable into XML 4 47
Excel file not created as expected 7 72
Download a website to hdd 2 68
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

777 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