xsl-list
[Top] [All Lists]

Re: [xsl] Generating ODF

2007-03-14 01:50:16
Michael B Allen <mba2000(_at_)ioplex(_dot_)com> writes:

On Tue, 13 Mar 2007 23:00:19 -0400
Michael B Allen <mba2000(_at_)ioplex(_dot_)com> wrote:

<text:p text:style-name="Code_20_Sample"><text:s text:c="4"/>'scope' =&gt; 
'sub',</text:p>
<snip>

There several hurdles in generating this.

1. Every line is text:p tagged separately

2. Indenting is represented using text:s tags.

Well that wasn't too bad:

<xsl:template match="pre">
    <xsl:for-each select="str:tokenize(., '&#10;')">
        <xsl:variable name="norm"
                    select="normalize-space(.)"/>
        <xsl:variable name="sp-count"
                    
select="string-length(substring-before(.,substring($norm,1,1)))"/>
        <text:p text:style-name="Code_20_Sample">
            <xsl:element name="text:s">
                <xsl:attribute name="text:c">
                    <xsl:value-of select="$sp-count"/>
                </xsl:attribute>
            </xsl:element>
            <xsl:value-of select="$norm"/>
        </text:p><xsl:text>
</xsl:text>
    </xsl:for-each>
</xsl:template>

But I'd still be interested in hearing other people's experiences
generating ODF.

Now on to tables ...

I have a stylesheet that converts HTML to OO (in part, it's not
finished but does enough for the app I wrote it for).

You can find it here:

   http://www.tapsellferrier.co.uk/.fn/h2ml2oo.xslt


-- 
Nic Ferrier
----------------------------------------------------------
Need a linux/java/python/web hacker?  I'm in need of work!
----------------------------------------------------------
http://www.tapsellferrier.co.uk   

--~------------------------------------------------------------------
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>