Re: [xsl] Generating ODF

Subject: Re: [xsl] Generating ODF
From: Michael B Allen <mba2000@xxxxxxxxxx>
Date: Tue, 13 Mar 2007 23:59:00 -0400
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 ...

Mike

-- 
Michael B Allen
PHP Active Directory SSO
http://www.ioplex.com/

Current Thread