aspose file tools
The moose likes XML and Related Technologies and the fly likes Help replacing characters using XSL Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Help replacing characters using XSL" Watch "Help replacing characters using XSL" New topic
Author

Help replacing characters using XSL

Greg L Tonn
Ranch Hand

Joined: Nov 27, 2006
Posts: 52
We have text data that has new line characters in it and when we transform it using our XSL the new lines preserved. So I was hoping to be able to replace the new line characters with the <br> tag.

XPath has a function, replace(string,pattern,replace). However, I can't get it to work with the <br> tag.

Does anyone have a better solution or know how I can get this one to work?



Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16487
    
    2

You don't want to replace the newline by the string "<br>". You want to replace it by a "br" element, and that isn't the same thing.

However this is an XSLT FAQ, let me just google it... yup, here you go:

http://www.dpawson.co.uk/xsl/sect2/replace.html#d9478e13
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Help replacing characters using XSL
 
Similar Threads
Keep HTML tag in String
handling multiple languages using XSL
JSTL out with JSP expression
struts, html:textarea
New line into HTML break using Xalan???