Re: [xsl] Generating ODF

Subject: Re: [xsl] Generating ODF
From: Nic James Ferrier <nferrier@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 14 Mar 2007 08:50:54 +0000
Michael B Allen <mba2000@xxxxxxxxxx> writes:

> On Tue, 13 Mar 2007 23:00:19 -0400
> Michael B Allen <mba2000@xxxxxxxxxx> 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   

Current Thread