XML : XSL template to javascript function

Here is my xml template:

      <xsl:template name="paragraphs">      <xsl:param name="class" />      <xsl:param name="text" />      <xsl:choose>      <xsl:when test="contains($text,'&#10;')">      <xsl:if test="string-length(substring-before($text,'&#10;')) &gt; 0"><p class="{$class}"><xsl:value-of select="substring-before($text,'&#10;')" /></p></xsl:if>      <xsl:call-template name="paragraphs"><xsl:with-param name="class" select="$class" /><xsl:with-param name="text" select="substring-after($text,'&#10;')" /></xsl:call-te$      </xsl:when>      <xsl:otherwise><p class="{$class}"><xsl:value-of select="$text" /></p></xsl:otherwise>      </xsl:choose>      </xsl:template>    

Here is how I am using it in the xsl stylesheet

     <xsl:call-template name="paragraphs"><xsl:with-param name="text" select="./comment" /></xsl:call-template>    

Now I need to convert the template into javascript. I honestly don't know how to do this.

I'd love some assistance on this.

No comments:

Post a Comment