xsl-list
[Top] [All Lists]

RE: transforming to breaks

2003-03-25 08:34:04
I have a node like <nodeName>blah blah&#13;&#10;more blah 
blah</nodeName>.
I wish to transform this to html, using <BR></BR> for the carriage
return/linefeed combo.

How can I do this?

Recursive template, e.g.

template "changer"
  param "text"
  choose
    when contains($text, "&#xA;")
      value-of substring-before($text, "&#xA;")
      <BR></BR>
      call-template "changer>
        with-param "text" substring-after($text, "&#xA;")
    otherwise
      value-of $text

The XML parser changes &#13;&#10; sequences into single &#10;, so you just need 
to change LINE FEED characters.

Cheers,

Jarno - Linnunradan käsikirja liftareille: Osa 14

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>