[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Handling linebreaks

Subject: Re: Handling linebreaks
From: "Manuel Montoro" <mmontoro@xxxxxxxxxxx>
Date: Thu, 30 Nov 2000 09:23:23 +0100
xsl linebreaks
Try this template. It accepts one param (texto) as the text to
transform and generates a <br /> for each carriage return.

  <xsl:template name="brize">
    <xsl:param name="texto" />

    <xsl:choose>
      <xsl:when test="contains($texto, '&#x0A;')">
        <xsl:variable name="linea1"><xsl:value-of select="substring-
before($texto, '&#x0A;')" /></xsl:variable>
        <xsl:variable name="resto"><xsl:value-of select="substring-
after($texto, '&#x0A;')" /></xsl:variable>

        <xsl:value-of select="$linea1" />
        <xsl:if test="$resto">
          <br />
          <xsl:call-template name="brize"><xsl:with-param
name="texto" select="$resto" /></xsl:call-template>
        </xsl:if>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$texto" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

Kind Regards

On 29 Nov 2000, at 17:30, Jerry Luna wrote:

> Currently I have an XML file with an element similar to the following:
>
> <CONTENT>text text text text
>                        text text text text
>
>                        text text text text
>                        text text
> </CONTENT>
>
>
> What is the best way to preserve the linespacing when I transform this
> XML file to HTML?
>
> a) Should I insert tags to associate with the linebreaks when building
> the XML content?  If I do this, how would I know when I run into those
> tags when I use <xsl:value-of select="CONTENT">?
>
> b) Or should I sent ascii characters (such as &#160; for whitespace)
> and if so, how do I do it???
>
> c)  Some other option??
>
> Jerry
> jerry@xxxxxxxxxxx
>
>
>
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


--------------------------------------------------
Manuel Antonio Montoro Navarro
Responsable Equipo Desarrollo Internet

NOVASOFT SOFTWARE FACTORY
Avda. de la Axarquía,29
Apdo. de Correos 174
29730 Rincón de la Victoria
Málaga (España)
Tlf:    +34 902 310031
Fax:  +34 902 310041
mmontoro@xxxxxxxxxxx
http://www.novasoftsf.com

Pensamiento del Dia:
    Dicen que el mono es tan inteligente que no habla para que
    no lo hagan trabajar
                                                  Rene Descartes.


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.