xsl-list
[Top] [All Lists]

RE: Data from DB in xsl

2002-08-28 21:17:36
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, '&#xA;&#xA;')">
      <p>
        <xsl:value-of select="substring-before($sText, '&#xA;&#xA;')"/>
      </p>
        <xsl:call-template name="paragrapher">
        <xsl:with-param name="sText" select="substring-after($sText, 
'&#xA;&#xA;')" />
      </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



<Prev in Thread] Current Thread [Next in Thread>