Hi.
I need help finding a viable solution to convert bbcode to html, this is where ive come so far, but fails when bbcodes get wrapped.
Src:
[quote id="ohoh81"]asdasda
[quote id="ohoh80"]adsad
[quote id="ohoh79"]asdad[/quote]
[/quote]
[/quote]
Code:
<xsl:variable name="rules">
<code check="
" ><br/></code>
<code check="\[(quote)(.*)\]" ><span class="quote"></code>
</xsl:variable>
<xsl:template match="text()" mode="BBCODE">
<xsl:call-template name="REPLACE_EM_ALL">
<xsl:with-param name="text" select="." />
<xsl:with-param name="pos" select="number(1)" />
</xsl:call-template>
</xsl:template>
<xsl:template name="REPLACE_EM_ALL">
<xsl:param name="text" />
<xsl:param name="pos" />
<xsl:variable name="newText" select="replace($text, ($rules/code[$pos]/@check), ($rules/code[$pos]))" />
<xsl:choose>
<xsl:when test="$rules/code[$pos +1]">
<xsl:call-template name="REPLACE_EM_ALL">
<xsl:with-param name="text" select="$newText" />
<xsl:with-param name="pos" select="$pos+1" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="$newText" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>