This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Data from DB in xsl
- From: Jarno dot Elovirta at nokia dot com
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 29 Aug 2002 07:17:36 +0300
- Subject: RE: [xsl] Data from DB in xsl
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi,
> on writing the code you gave me, i get the error below:
>
> "Unexpected character in query string. contains($sText,-->\<--n\n)"
>
> here is my code:
>
> <xsl:template name="paragrapher">
> <xsl:param name="sText"/>
> <xsl:if test="contains($sText,\n\n)">
> <p>
> <xsl:value-of
> select="substring-before($sText,\n\n)"/>
> </p>
> </xsl:if>
> </xsl:template>
Yes, well, that was pseudo-code - XPath doesn't use \n to denote a LINE FEED character. And you missed the else clause, too.
<xsl:template name="paragrapher">
<xsl:param name="sText"/>
<xsl:choose>
<xsl:when test="contains($sText, '

')">
<p>
<xsl:value-of select="substring-before($sText, '

')"/>
</p>
<xsl:call-template name="paragrapher">
<xsl:with-param name="sText" select="substring-after($sText, '

')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<p>
<xsl:value-of select="$sText"/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Jarno
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list