|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Handling Non Well conformed HTML content
Hi Senthil, Please try this stylesheet: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes" /> <xsl:template match="/broadcast"> <html> <xsl:apply-templates select="content_vars/content" /> </html> </xsl:template> <xsl:template match="content"> <xsl:variable name="temp1" select="translate(., '[]', '')" /> <xsl:variable name="temp2" select="//*[not(*)][contains($temp1, local-name())]" /> <xsl:variable name="temp3" select="local-name(//*[not(*)][contains($temp1, local-name())])" /> <p> <xsl:value-of select="substring-before($temp1, $temp3)" /><xsl:value-of select="$temp2" /><xsl:value-of select="substring-after($temp1, $temp3)" /> </p> </xsl:template> </xsl:stylesheet> This when applied to XML: <?xml version="1.0" encoding="UTF-8"?>
<broadcast>
<content_vars>
<content name="subject"><html>Hello [[BUYERS_NAME]]</html></content>
<content name="text">REF Order [WEB_ORDER_NUMBER]</content>
</content_vars>
<ORDER_FEED>
<ORDER>
<ORDER_HEADER>
<BUYERS_NAME>Senthil</BUYERS_NAME>
<WEB_ORDER_NUMBER>W12345</WEB_ORDER_NUMBER>
</ORDER_HEADER>
</ORDER>
</ORDER_FEED>
</broadcast>Produces output: <html> <p>Hello Senthil</p> <p>REF Order W12345</p> </html> This works, but I have applied a sort of brute force programming here (with //*[not(*)]) ! On 10/3/06, Senthilkumaravelan Krishnanatham <senthil@xxxxxxxxx> wrote:
-- Regards, Mukul Gandhi
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Cast Your Vote
We need your help – Vote for DataDirect XML Products!
Winners and finalists announced at SOA World Conference in November. 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
|







