xsl-list
[Top] [All Lists]

Re: WordML to XML/HTML

2005-02-05 04:12:36
Tempore 10:19:45, die 02/05/2005 AD, hinc in xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Joris Gillis <roac(_at_)pandora(_dot_)be>:

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)

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>