Re: [xsl] WordML to XML/HTML

Subject: Re: [xsl] WordML to XML/HTML
From: Vasu Nanjangud <vasdeep@xxxxxxxxx>
Date: Sat, 5 Feb 2005 22:30:39 -0800 (PST)
Thanks Joris for the help!

Regards,
Vasu

Subject: Re: [xsl] WordML to XML/HTML
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Sat, 05 Feb 2005 12:12:36 +0100
 

Tempore 10:19:45, die 02/05/2005 AD, hinc in
xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Joris Gillis
<roac@xxxxxxxxxx>:


You'll get this output:
<i>
	<u>
		<b>I have bold and italics and underscore
	</b>
	</u>
</i>


You might also use inline CSS styling.
The construction of the 'style' attribute might be
easier to comprehend than the recursive element
creation method.

to get this output:

<span style="font-style: italic;text-decoration:
underline;font-weight: bold;">I have bold and italics
and underscore</span>

You can use an XSLT like this:

<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";;
version="1.0" xmlns:w="specify-the-namespace-here"
exclude-result-prefixes="w">
<xsl:output method="xml"/>


<xsl:template match="w:r">
	<xsl:apply-templates select="w:t"/>
</xsl:template>


<xsl:template match="w:t">
	<span>
		<xsl:apply-templates select="../w:rPr"/>
		<xsl:apply-templates/>
	</span>
</xsl:template>


<xsl:template match="w:rPr">
	<xsl:attribute name="style">
		<xsl:apply-templates/>
	</xsl:attribute>
</xsl:template>


<xsl:template match="w:u">text-decoration:
underline;</xsl:template>
<xsl:template match="w:b">font-weight:
bold;</xsl:template>
<xsl:template match="w:i">font-style:
italic;</xsl:template>

</xsl:stylesheet>


regards,
--
Joris Gillis
(http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
Veni, vidi, wiki (http://www.wikipedia.org)



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250

Current Thread