RE: [xsl] String manipulation & Line Breaks

Subject: RE: [xsl] String manipulation & Line Breaks
From: Américo Albuquerque <aalbuquerque@xxxxxxxxxxxxxxxx>
Date: Tue, 25 Mar 2003 16:27:23 -0000

> -----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: [xsl] 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
You'll have to add this to your xsl:stylesheet:

 <xsl:template name="replace">
  <xsl:param name="str" select="''"/>
  <xsl:param name="from" select="''"/>
  <xsl:param name="to"></xsl:param>
   <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:value-of select="$str"/>

Hope this helps you.

 XSL-List info and archive:

Current Thread