This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook-apps] Pros and cons DocBook vs Word2003



On Friday, November 14, 2003, at 09:03 AM, Jirka Kosek wrote:


You can think about WordML as RTF expressed in XML syntax. So nothing fancy and elegant, but much more easy to process than .doc or .rtf.

Awhile back I found some information on WordML and played with a stylesheet for it. It is incredibly minimal, and I can't confirm it's valid since I do not have access to Word2003, but it should give an idea. At some point it'd be nice to see full support for WordML, though html + css can get you a long way to native-.doc-like files (and is a lot easier to do than WordML).


Anyway, here's an instance from a DocBook-like schema I was also playing with:

<article>
<info>
<title>Article Title</title>
</info>
<content>
<section>
<info>
<title>Section Title</title>
</info>
<para>A paragraph.</para>
<para>Another paragraph, with <emphasis>emphasis</emphasis> and a footnote.<footnote><para>Footnote</para></footnote></para>
</section>
</content>
</article>


And here's the stylesheet:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="http://schemas.microsoft.com/office/word/2003/2/wordml";
xmlns:wx="http://schemas.microsoft.com/office/word/2003/2/auxHint";>
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:processing-instruction
name="mso-application">progid="Word.Document"</xsl:processing- instruction>
<w:wordDocument>
<xsl:apply-templates/>
</w:wordDocument>
</xsl:template>
<xsl:template match="/">
<o:DocumentProperties>
<o:Title>
<xsl:value-of select="//info/title"/>
</o:Title>
</o:DocumentProperties>
<!-- Define styles used in the document -->
<w:styles>
<w:fonts>
<w:defaultFonts w:ascii="Times New Roman" w:fareast="Times New Roman" w:h-ansi="Times New Roman" w:cs="Times New Roman"/>
<w:font w:name="Tahoma">
<w:panose-1 w:val="020B0604030504040204"/>
<w:charset w:val="00"/>
<w:family w:val="Swiss"/>
<w:pitch w:val="variable"/>
<w:sig w:usb-0="61007A87" w:usb-1="80000000" w:usb-2="00000008" w:usb-3="00000000" w:csb-0="000101FF" w:csb-1="00000000"/>
</w:font>
</w:fonts>
<w:versionOfBuiltInStylenames w:val="3"/>
<w:latentStyles w:defLockedState="off" w:latentStyleCount="156"/>
<w:style w:type="paragraph" w:default="on" w:styleId="MsoBodyText">
<w:name w:val="MsoBodyText"/>
<w:rPr>
<wx:font wx:val="Times New Roman"/>
</w:rPr>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading1">
<w:name w:val="heading 1"/>
<w:pPr>
<w:pStyle w:val="Heading1"/>
<w:keepNext/>
<w:spacing w:before="60" w:after="120"/>
<w:outlineLvl w:val="1"/>
</w:pPr>
<w:rPr>
<w:rFonts w:ascii="Arial" w:h-ansi="Arial"/>
<w:b/>
<w:sz w:val="36"/>
</w:rPr>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading2">
<w:name w:val="heading 2"/>
<w:pPr>
<w:pStyle w:val="Heading2"/>
<w:keepNext/>
<w:spacing w:before="180" w:after="0"/>
<w:outlineLvl w:val="2"/>
</w:pPr>
<w:rPr>
<w:rFonts w:ascii="Arial" w:h-ansi="Arial"/>
<w:b/>
<w:sz w:val="28"/>
</w:rPr>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading3">
<w:name w:val="heading 3"/>
<w:pPr>
<w:pStyle w:val="Heading3"/>
<w:keepNext/>
<w:spacing w:before="240" w:after="60"/>
<w:outlineLvl w:val="2"/>
</w:pPr>
<w:rPr>
<w:rFonts w:ascii="Arial" w:h-ansi="Arial"/>
<w:b/>
<w:sz w:val="26"/>
</w:rPr>
</w:style>
<w:style w:type="character" w:styleId="Hyperlink">
<w:name w:val="Hyperlink"/>
<w:basedOn w:val="DefaultParagraphFont"/>
<w:rPr>
<w:color w:val="0000FF"/>
<w:u w:val="single"/>
</w:rPr>
</w:style>
</w:styles>
<!-- Start the actual document -->
<w:body>
<xsl:apply-templates/>
</w:body>
</xsl:template>
<xsl:template match="article/info/title">
<w:p>
<w:pPr>
<w:pStyle w:val="Heading1"/>
</w:pPr>
<w:r>
<w:t>
<xsl:apply-templates/>
</w:t>
</w:r>
</w:p>
</xsl:template>
<xsl:template match="article/content/section/info/title">
<w:p>
<w:pPr>
<w:pStyle w:val="Heading2"/>
</w:pPr>
<w:r>
<w:t>
<xsl:apply-templates/>
</w:t>
</w:r>
</w:p>
</xsl:template>
<xsl:template match="para">
<w:p>
<w:pPr>
<w:pStyle w:val="MsoBodyText"/>
</w:pPr>
<w:r><w:t xml:space="preserve"><xsl:apply-templates/></w:t></w:r>
</w:p>
</xsl:template>
<xsl:template match="footnote">
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
<w:footnote>
<w:p>
<w:pPr>
<w:pStyle w:val="FootnoteText"/>
</w:pPr>
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
<w:footnoteRef/>
</w:r>
<w:r>
<w:t xml:space="preserve"><xsl:value-of select="para"/></w:t>
</w:r>
</w:p>
</w:footnote>
</w:r>
</xsl:template>
<xsl:template match="emphasis">
<w:r>
<w:rPr>
<w:i/>
</w:rPr>
<w:t xml:space="preserve"><xsl:apply-templates/></w:t>
</w:r>
</xsl:template>
<xsl:template match="link">
<w:hlink w:dest="{@url}">
<w:r>
<w:rPr>
<w:rStyle w:val="Hyperlink"/>
<w:i/>
</w:rPr>
<xsl:apply-templates/>
</w:r>
</w:hlink>
</xsl:template>
</xsl:stylesheet>


Bruce


To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]