[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Line feeds to breaks


Subject: [xsl] Line feeds to breaks
From: Aaron Johnson <Aaron2.Johnson@xxxxxxxxx>
Date: Wed, 19 Jan 2005 10:49:33 +0000

HiB


 

Appologies if you have already received this ...our email system is playing
silly buggers...



I'm having a problem with converting line feeds to html breaks.



Microsoft value is &#10;




Java /Unix value is &#13;





When the page is transformed, the line breaks are huge depending on
which
value is used and what platform you display the page on.





Is there a way to get around this?



Any help would be most appreciated thank you.




AMJ





    

<!--

  
Template: lf2br

  
Converts XML linefeeds to html <br />


NB: if linebreaks seem strange, stylus studio has


helpfully reformatted the xml for you. You need to


check that transforms read ($StringToTransform,'&#10;')


 
Inputs:

    
StringToTransform



Output:

    
String with LF's converted to <br />


-->

     

<xsl:template name="lf2br">


<xsl:param name="StringToTransform"/>


<xsl:choose>

     
<xsl:when test="contains($StringToTransform,'&#13;')">



<!--

        
<xsl:value-of select="substring-before($StringToTransform,'&#10;')"/>


-->

              

<xsl:call-template name="convertcase">


<xsl:with-param 
name="toconvert"
select="substring-before($StringToTransform,'&#13;')"/>


<xsl:with-param name="conversion" select="'proper'"/>


</xsl:call-template>


<br/>

            
<xsl:call-template name="lf2br">


<xsl:with-param name="StringToTransform">


<xsl:value-of
select="substring-after($StringToTransform,'&#13;')"/>


</xsl:with-param>


</xsl:call-template>


</xsl:when>

      
<xsl:otherwise>

  

<!--

        
<xsl:value-of select="$StringToTransform"/>


-->

              

<xsl:call-template name="convertcase">


<xsl:with-param name="toconvert"
select="$StringToTransform"/>


<xsl:with-param name="conversion" select="'proper'"/>


</xsl:call-template>


</xsl:otherwise>

 
</xsl:choose>

    
</xsl:template>


......................................................................

Aaron Johnson
GUI / XSLT development
Academic Technologies Group [ATG]
University of the West of England

ext: 81051
t: 0117 3281051 
www: http://atg.uwe.ac.uk/aaron
e: aaron2.johnson@xxxxxxxxx
......................................................................

......................................................................

SECURITY POLICY:

Please note that ATG will only accept
e-mail attachments in the following
formats:

.doc,.gif,.jpg,.mdb,.png,.xls,.zip,.psd
.html,.shtml,.xml,.xsl,.sdf,.asp

...as a mac user I will accept files
compressed using Dropstuff.
......................................................................

This communication is intended solely
for the use of the individual(s) to whom
it is addressed. Any opinions presented
are those of the author and do not
necessarily represent the University of
the West of England, Bristol.
......................................................................




This email has been independently scanned for viruses and any virus software has been removed using McAfee anti-virus software


Current Thread
Keywords