• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help replacing characters using XSL

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic