"how to convert html to bbcode" Code Answer


It should be doable with XSLT in text output mode:

<xsl:output method="text">
<xsl:template match="b|strong"><xsl:apply-templates/></xsl:template>
<xsl:template match="br">&#10;</xsl:template>
<xsl:template match="p">&#10;<xsl:apply-templates/>&#10;</xsl:template>
<xsl:template match="a"><xsl:apply-templates/></xsl:template>
<xsl:template match="text()"><x:value-of select="normalize-space(.)"/></xsl:template>

To get there parse HTML and use built-in XSLT processor.

By blafoo23-spam-6bb25c88cda4 on August 17 2022

Answers related to “how to convert html to bbcode”

Only authorized users can answer the search term. Please sign in first, or register a free account.