Subject: RE: RE: [xsl] WordML to XML/HTML From: Vasu Nanjangud <vasdeep@xxxxxxxxx> Date: Sat, 5 Feb 2005 09:20:26 -0800 (PST) |
Thanks Omprakash. The example you had provided does not work for me. Within this block<xsl:when test="child contains w:i"> <I> <!-- print italic text here --> </I> </xsl:when> I wouldn't know the part that is to have italics, separately. I want to apply the "italics", "bold", "underscore" tags if they exist in the "w:r" block for the text contained within the enclosed "w:t" tag. Ideally, for a "w:r" block, I want to find the existence of "w:i", "w:b", "w:u" and other such formatting instructions and then apply that to the "text" inside the "w:t" block that is contained in the "w"r" block, in one shot. i.e. for the case <w:r> <w:rPr> <w:i/> <w:b/> <w:u/> </w:rPr> <w:t> Hello there <w:/t> </w:r> should get converted to <i><b><u>Hello there </u></b></i> where as <w:r> <w:rPr> <w:b/> <w:u/> </w:rPr> <w:t> Hello there <w:/t> </w:r> should get converted to <b><u>Hello there </u></b> and so on.... Please advise... Also, "Lincoln Mitchell" - You had had once posted about an advanced conversion case "converting listPr tags". I assume that you have already taken care of the case that I have just mentioned. Could you please let me know how you did it. Thanks in Advance, Vasu Subject: RE: [xsl] WordML to XML/HTML From: "Touchtel" <omprakashv@xxxxxxxxxxxxxxxxx> Date: Sat, 5 Feb 2005 10:51:17 +0530 Hi, You are trying to output only an <I> or a <B> or a <U> in isolation which XSLT doesn't allow. The adding of an element is an atomic operation in that you cannot an an <I> without adding a corresponding </I>. Also, the xsl-if isn't suitable in your case and the xsl:choose is available for this purpose. You may also want to pay attention to your predicates as 'child contains w:i' is not correct. You might want to try as follows: <xsl:template match="w:r"> <xsl:choose> <xsl:when test="child contains w:i"> <I> print italic text here </I> </xsl:when> <xsl:when test="child contains w:b"> <B> print bold text here </B> </xsl:when> <xsl:when test="child contains w:u"> <U> print UL text here </U> </xsl:when> </xsl:choose> </xsl:template> Cheers, Omprakash.V --- Vasu Nanjangud <vasdeep@xxxxxxxxx> wrote: > > --- Vasu Nanjangud <vasdeep@xxxxxxxxx> wrote: > > > Date: Fri, 4 Feb 2005 18:40:46 -0800 (PST) > > From: Vasu Nanjangud <vasdeep@xxxxxxxxx> > > Subject: WordML to XML/HTML > > To: xsl-list-digest@xxxxxxxxxxxxxxxxxxxxxx > > > > Hi, > > > > I have WordML data like this... > > <w:r> > > <w:rPr> > > <w:i> > > <w:u w:val="single"/> > > <w:b/> > > </w:rPr> > > <w:t>I have bold and italics and underscore > > </w:t> > > </w:r> > > > > For this to be converted to html, I'm trying to > > write > > XSLT code using this logic > > <xsl:template match="w:r" > > > if child contains "w:i" > > <xsl:text><i></xsl:text> > > if child contains "w:b" > > <xsl:text><b></xsl:text> > > if child contains "w:u" > > <xsl:text><i></xsl:text> > > > > print the text contained in "w:t" > > > > if child contains "w:u" > > <xsl:text></i></xsl:text> > > if child contains "w:b" > > <xsl:text></b></xsl:text> > > if child contains "w:/i" > > <xsl:text><i></xsl:text> > > </xsl:template> > > > > I'm new to XSLT and I'm trying to write XSLT for > > converting WordML to html data... > > Could someone please tell me how I can achieve > > this... > > > > Thanks, > > Vasu > > > > > > > > > > __________________________________ > > Do you Yahoo!? > > Yahoo! Mail - You care about security. So do we. > > http://promotions.yahoo.com/new_mail > > > > > > > __________________________________ > Do you Yahoo!? > All your favorites on one personal page Try My > Yahoo! > http://my.yahoo.com > __________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Help with perious ancestor el, Andrey Solonchuk | Thread | Re: [xsl] WordML to XML/HTML, Vasu Nanjangud |
RE: [xsl] Decimal precision, Michael Kay | Date | Re: [xsl] Decimal precision, Dimitre Novatchev |
Month |