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

RE: String manipulation & Line Breaks

Subject: RE: String manipulation & Line Breaks
From: Américo Albuquerque <aalbuquerque@xxxxxxxxxxxxxxxx>
Date: Tue, 25 Mar 2003 16:27:23 -0000
xslt remove line breaks
Hi.

> -----Mensagem original-----
> De: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] Em nome de 
> Marty McKeever
> Enviada: terça-feira, 25 de Março de 2003 15:15
> Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Assunto:  String manipulation & Line Breaks
> 
(...)
> 
> <xsl:call-template name="replace">
> <xsl:with-param name="str" select="bio"/>
> <xsl:with-param name="from">\n</xsl:with-param>
Here you have to use &_#10; (without the underscore) instead,  in XML
'\n' is just a string containing 2 chars

> <xsl:with-param name="to"><br/></xsl:with-param> </xsl:call-template>
You'll have to use a nodeset() function with this parameter. You'll have
to check the docs of your xslt processor for that.

This stylesheet work as intended to but it will only work with msxml
processor.
You'll have to add this to your xsl:stylesheet:
 xmlns:ms="urn:schemas-microsoft-com:xslt"


 <xsl:template name="replace">
  <xsl:param name="str" select="''"/>
  <xsl:param name="from" select="''"/>
  <xsl:param name="to"></xsl:param>
  <xsl:choose>
   <xsl:when test="contains($str,$from)">
   <xsl:value-of select="substring-before($str,$from)"/>
   <!--
     -- this is the part that you'll have to change, depending on your
xslt processor
     -->
   <xsl:copy-of select="ms:node-set($to)"/>
   <xsl:call-template name="replace">
    <xsl:with-param name="str" select="substring-after($str,$from)"/>
    <xsl:with-param name="from" select="$from"/>
    <xsl:with-param name="to" select="$to"/>
   </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
   <xsl:value-of select="$str"/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>

Hope this helps you.


 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.