Hi.
-----Mensagem original-----
De: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] Em nome de
Marty McKeever
Enviada: terça-feira, 25 de Março de 2003 15:15
Para: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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
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