[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XML to Word Document

Subject: RE: XML to Word Document
From: "Meltsner, Kenneth" <Kenneth.Meltsner@xxxxxx>
Date: Mon, 1 Oct 2001 20:00:53 -0400
xml to word xslt
The HTML -> Word route works quite well, especially if you create a CSS stylesheet to tweak the finer points of paragraph, list item, etc. layout.  We use XSL in the manner to create manuals for our methodologies -- cruddy RTF to cruddy XML to clean XML to (relatively) clean HTML.  After we generate the HTML file, it's inserted into a dummy Word document so that the table of contents will come out right.

The worst part of the process is the RTF to XML part, but for this limited domain (converting RTF generated programmatically to XML) we're OK.

I believe that the stylesheet can include the IE-specifc styles related to printing as well, so you can force page breaks on certain elements.

Finally, you can even use the Microsoft HTML Help Workshop to compile HTML into Microsoft's CHM format, a compressed HTML + index format used in MS programs for Help.  It's trivial to create the HHC file required by the Workshop as long as part of the HTML generation process.

Ken

I've appended the guts of the HHC generation stylesheet in case anyone's interested:
[The document's root is element is "manual" with "activities" and one or more "chapter" elements within that.]
....

<xsl:template match="/" >
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft HTML Help Workshop 4.1" />
<xsl:comment>Site Generator 1.0</xsl:comment>
</HEAD>
<BODY>
<OBJECT type="text/site properties"></OBJECT>
<UL>
<xsl:apply-templates />
</UL>
</BODY>
</HTML>
</xsl:template>

<xsl:template match="manual">
<xsl:apply-templates select="activities"/>
<xsl:apply-templates select="//chapter" />
</xsl:template>

<xsl:template match="activities">
<xsl:apply-templates select="activity" /></xsl:template>

<xsl:template match="activity">
<LI><OBJECT type="text/sitemap">
<xsl:element name="param">
	<xsl:attribute name="name">Name</xsl:attribute>
	<xsl:attribute name="value"><xsl:value-of select="@wbs-name" /></xsl:attribute>
</xsl:element>
<param name="Local" value="{@wbs-target}.html" />	</OBJECT></LI>
<xsl:if test="./activity">
	<UL>
		<xsl:apply-templates select="./*" />
	</UL>
</xsl:if>
</xsl:template>
<xsl:template match="chapter[starts-with(string(@fullname),'Chapter 1')]">
	</xsl:template>
<xsl:template match="chapter">
<LI><OBJECT type="text/sitemap">
<xsl:element name="param">
	<xsl:attribute name="name">Name</xsl:attribute>
	<xsl:attribute name="value"><xsl:value-of select="@fullname" /></xsl:attribute>
</xsl:element>
<param name="Local" value="{@fullname}.html" />	</OBJECT></LI>
<xsl:if test="./activity">
	<UL>
		<xsl:apply-templates select="./*" />
	</UL>
</xsl:if>
</xsl:template>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.