Subject: Re: Convert newlines to <BR/> From: "Jon Smirl" <jonsmirl@xxxxxxxxxxxx> Date: Wed, 29 Dec 1999 11:14:45 -0500 |
I should have been a Lisp programmer -- every problem I'm having needs recursion to fix it. Thanks for the solution. Here's an extension function for the same thing: ---------------------------------------------------------------------------- ---------------------- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:CRLF="http://www.jclark.com/xt/java/net.px.extension.CRLF"> <xsl:value-of disable-output-escaping="yes" select="CRLF:replace(string(.))"/> package net.px.extension; public class CRLF { public static String replace(String line) { StringBuffer sb = new StringBuffer(line.length() + 50); int i = 0; int k = 0; int cr = 13; while (k != -1) { k = line.indexOf(cr, i); if (k != -1) { sb.append(line.substring(i, k - 1)); sb.append("<br/>"); } else sb.append(line.substring(i)); i = k + 1; } return sb.toString(); } } Jon Smirl jonsmirl@xxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Convert newlines to <BR/>, Steve Muench | Thread | RE: Convert newlines to <BR/>, Mike Brown |
Re: removing duplicates problem (so, Jeremy Quinn | Date | xsl:variable question, costempd |
Month |