Re: [xsl] Line end conversion.

Subject: Re: [xsl] Line end conversion.
From: andrew.curry@xxxxxxxxxxxx
Date: Tue, 2 Dec 2003 14:21:06 -0000
Something like this could be used

<xsl:template name="replace">
  <xsl:param name="string" select="." />
  <xsl:choose>
    <xsl:when test="not($string)" />
    <xsl:when test="contains($string, '|')">
      <xsl:value-of select="substring-before($string, '|')" />
      <br />
      <xsl:call-template name="replace">
        <xsl:with-param name="string"
                        select="substring-after($string, '|')" />
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$string" />
      <br />
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<xsl:template match="string">
  <tr>
    <td>
      <xsl:call-template name="replace" />
    </td>
  </tr>
</xsl:template>

http://aspn.activestate.com/ASPN/Mail/Message/xsl-list/1393343




----- Original Message ----- 
From: "Ben Trafford" <ben@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, December 02, 2003 2:08 PM
Subject: [xsl] Line end conversion.


>
> Hi!
>
> I have an odd little problem. I want to match all linefeeds with a given
> element's content, and convert them to "\n". Does anybody know of a good
> way to do so?
>
> In other words...
>
> <element>This is a phrase with a line end.
>
> It's very frustrating.</element>
>
> ...becomes...
>
> <element>This is a phrase with a line end.\n\nIt's very
frustrating.</element>
>
> --->Ben
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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


Current Thread