Subject: Re: [xsl] Preceding sibling selction From: Senthilukvelaan <skumaravelan@xxxxxxxxxxxxxx> Date: Tue, 3 Mar 2009 14:25:55 -0800 |
Hi , Can you please help me ,How do I get two distinct Body text values for Different content-Type values? I could not figure out the missing piece. Thanks S On Tue, Mar 3, 2009 at 12:04 PM, Senthilukvelaan <skumaravelan@xxxxxxxxxxxxxx> wrote: > Hi All, > As Michael suggested, Though I have added two matching templates for > the content-type, My desired output is not showing. I am not sure What > am I missing in here. > > My XML Input looks like this . > > <Message> > <Return-path></Return-path> > <Received> > </Received> > <From>testing@xxxxxxxxx</From> > <Subject>Testing Mime </Subject> > <MIME-version>1.0</MIME-version> > <Content-type boundary="test">multipart/alternative</Content-type> > <Body> > <Message> > <Content-Disposition>inline</Content-Disposition> > <Content-Type charset="ISO-8859-1">text/plain</Content-Type> > <Content-Transfer-Encoding>quoted-printable</Content-Transfer-Encoding> > <Body> > Hello Welcome to MIme Text message. > </Body> > </Message> > <Message> > <Content-Disposition>inline</Content-Disposition> > <Content-Type charset="ISO-8859-1">text/html</Content-Type> > <Content-Transfer-Encoding>quoted-printable</Content-Transfer-Encoding> > <Body> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <title>Testing MIME</title> > <meta content="text/html; charset=utf-8" http-equiv="content-type"/> > </head> > <body> > <p> > Hello Welcome to MIme HTML message. > </p> > </body> > </html> > </Body> > </Message> > </Body> > </Message> > > My XSLT is the below. > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> > <xsl:template match="/"> > <html> > <body> > <table> > <xsl:call-template name="text"></xsl:call-template> > <xsl:call-template name="html"></xsl:call-template> > </table> > </body> > </html> > </xsl:template> > <xsl:template name="text" match="Message[Content-Type='text/plain']/Body"> > <div id="textForm"> > <textarea id="output" readonly="readonly" rows='30'> > <xsl:value-of select="." /> > </textarea> > </div> > </xsl:template> > > <xsl:template name="html" match="Message[Content-Type='text/html']/Body"> > <div id="htmlForm"> > <xsl:value-of select="." disable-output-escaping="yes"/> > </div> > </xsl:template> > </xsl:stylesheet> > > I want to show only the Body text value for the said match. > I am not sure ,which node causing the problem to show the Body text value? > > Kindly help. > > > > On Tue, Mar 3, 2009 at 12:14 AM, Michael Kay <mike@xxxxxxxxxxxx> wrote: >> >> I would have two template rules: >> >> <xsl:template match="MIME[Content-Type='text/plain']/BODY"> >> ... >> </xsl:template> >> >> and another >> >> <xsl:template match="MIME[Content-Type='text/html']/BODY"> >> ... >> </xsl:template> >> >> to match BODY elements based on the Content-Type of their enclosing MIME >> element. >> >> Michael Kay >> http://www.saxonica.com/ >> >>> -----Original Message----- >>> From: Senthilukvelaan [mailto:skumaravelan@xxxxxxxxxxxxxx] >>> Sent: 03 March 2009 05:10 >>> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx >>> Subject: [xsl] Preceding sibling selction >>> >>> Hi >>> I would like to produce the below expected output, How I do >>> select a BODY, based on the preceding sibling value . >>> >>> If it is "text/plain" It should be shown in text area node. >>> If it is "text/html" and it should be selected and rendered. >>> I need a help in selecting the testing the preceding sibling >>> . I am not sure ,How do I escape a "/". >>> >>> Thanks, >>> SK >>> >>> XML message >>> <BODY> >>> <Parts> >>> <MIME> >>> <Content-Type charset="iso-8859-1">text/plain</Content-Type> >>> <Content-transfer-encoding>7bit</Content-transfer-encoding> >>> <BODY> >>> Here is the text of the message. >>> </BODY> >>> </MIME> >>> <MIME> >>> <Content-Type charset="iso-8859-1">text/html</Content-Type> >>> <Content-transfer-encoding>binary</Content-transfer-encoding> >>> <BODY> >>> <HTML> >>> <HEAD></HEAD> >>> <BODY> >>> <P> >>> Here is the html of the message. >>> </P> >>> </BODY> >>> </HTML> >>> </BODY> >>> </MIME> >>> </Parts> >>> </BODY> >>> >>> Expected output: >>> >>> <html> >>> <div id=htmlForm> >>> <HTML> >>> <HEAD></HEAD> >>> <BODY> >>> <P> >>> Here is the html of the message. >>> </P> >>> </BODY> >>> </HTML> >>> </div> >>> <div id=textForm> >>> <textarea id="output" readonly="readonly"rows='30'> Here is >>> the text of the message. >>> </textarea> >>> </div> >>> <html>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Preceding sibling selctio, David Carlisle | Thread | RE: [xsl] Preceding sibling selctio, Michael Kay |
Re: [xsl] Preceding sibling selctio, David Carlisle | Date | Re: [xsl] Preceding sibling selctio, David Carlisle |
Month |