[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: HTML character entity issue
Atul,
I haven't read the original post, but I guess it would be sufficient to "repair" the XML during processing. Of course it is always better to get correct XML in the first place. Also sometimes it is simpler to preprocess such documents with a different tools to search and replace all "<br/>" with "<br/>", but nevertheless it is possible with XSL. "<br/>" is nothing special for XSL, just simple text. So any "repair" must go into a template that processes text: <xsl:template match="text()" priority="2"> <xsl:call-template name="fix-br"> <xsl:with-param name="text" select="."/> </xsl:call-template> </xsl:template> <xsl:template name="fix-br"> <xsl:param name="text" select="''"/> <xsl:variable name="bad-br" select="'<br/>'"/> <xsl:choose> <xsl:when test="contains($text, $bad-br)"> <xsl:value-of select="substring-before($text, $bad-br)"/> <br/> <xsl:call-template name="fix-br"> <xsl:with-param name="text" select="substring-after($text, $bad-br)"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$text"/> </xsl:otherwise> </xsl:choose> </xsl:template> This is recursive in case there is more than one "bad-br" in your content. With XSLT 2.0 it could be written with a function and/or regular expressions. HTH, - Michael (who sometimes has to fix bad content as well) Am 23.12.2008 um 20:25 schrieb Atul Shinh: Hey thanks Michael and Vasu for replying back. My response got slow on this. Nothing out of this seems to be working.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|