Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 21st, 2011, 04:45 PM
Registered User
 
Join Date: Jul 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT output to HTML - xml element text should look exactly as laid out in xml element

Hi There,

I have an XML file I am transforming with XSLT, output to HTML. However, I have an element that I am receiving with Text, including line feed and carriage returns (formatted). What I need to do is output that to HTML so that it looks exactly like it does when in the XML element.
I've looked in books, etc. But cannot find an answer. Just need to somehow preserve the XML element and display it as such... Html just streams all of the text.

Code:
<MESSAGE>
      <TranslationReport>
Translation Report
==================
Contains errors ? true
Contains warnings ? false
There are 9 entries in the report
Current output--
HTML Code:
Translation Report ================== Contains errors ? true Contains warnings ? false There are 9 entries in the report
Thanks,
Dj
Reply With Quote
  #2 (permalink)  
Old July 21st, 2011, 04:54 PM
mhkay's Avatar
Wrox Author
Points: 18,438, Level: 59
Points: 18,438, Level: 59 Points: 18,438, Level: 59 Points: 18,438, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,954
Thanks: 0
Thanked 290 Times in 285 Posts
Default

Try wrapping an HTML
Code:
<pre>
element around it.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Reply With Quote
  #3 (permalink)  
Old July 21st, 2011, 05:09 PM
Registered User
 
Join Date: Jul 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by mhkay View Post
Try wrapping an HTML
Code:
<pre>
element around it.
Thanks Michael. I had tried that and it didn't work.
Not sure if it is a table in the html. I had it in a template too. Not sure of the rules...
Reply With Quote
  #4 (permalink)  
Old July 21st, 2011, 05:16 PM
Registered User
 
Join Date: Jul 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by DjGogga View Post
Thanks Michael. I had tried that and it didn't work.
Not sure if it is a table in the html. I had it in a template too. Not sure of the rules...
Looks like I typed too fast. I meant. Not sure if it is because it is within a table.
I've tried it so many ways hard to keep track of what I haven't tried. But thanks for confirming that <pre should be something that works.

Also, my xslt is v 1.0 and using Saxon 6.5.5

Cheers,
Dj
Reply With Quote
  #5 (permalink)  
Old July 21st, 2011, 05:39 PM
Registered User
 
Join Date: Jul 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Michael,

Thanks so much. I was able to create a test xslt and using <pre actually worked for my XML. So, it definitely is just because of where it is in the html or something like that.
Since I am "updating" an xslt with nicely formatted html, I'll just have to play with it and maybe change the look a bit.

Cheers,
Dj
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I display xml element tags as it is in HTML gkrishna.tibco XSLT 2 November 22nd, 2010 06:42 AM
Displaying XML element in HTML attribute using XSLT bribon XSLT 3 June 16th, 2009 12:30 PM
remove duplicate text in an output html element mrame XSLT 1 June 20th, 2008 01:41 AM
XML element with delimited values and XSLT Clark Kent XSLT 15 May 7th, 2008 10:10 AM
Write XML element into textbox with XSLT tcstom XSLT 4 July 5th, 2006 04:08 AM



All times are GMT -4. The time now is 08:10 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.