I have a variable in XML which I would like to format. In variable, it's HTML with tags. Our system produces too many p tags, so I would like to remove all <p>
and closing </p>
. There is text in between p tags, which I want to stay, just remove p and /p tags.
<xsl:value-of select="php:functionString('str_replace',$remove,'',normalize-space(php:functionString('html_entity_decode',description)))" />
I've tried with this, but this just removes one p and not closing one.
What is the best solution?
Here is the whole template. How i can implement it: thank you for your answer. I completely new to XSL and i didn't managed to get it to work. Here is my the section of the code. I would like to remove p tag from variable description.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" exclude-result-prefixes="php">
<xsl:output method="xml" indent="yes" encoding="UTF-8" omit-xml-declaration="yes"/>
<xsl:template match="/">
<products>
<xsl:for-each select="objects/object">
<xsl:element name="name"><xsl:value-of select="name"/></xsl:element>
<xsl:element name="url"><xsl:value-of select="product_url"/></xsl:element>
<xsl:element name="description"><xsl:value-of select="description"/> </xsl:element>
</products>
</xsl:template>
</xsl:stylesheet>