You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jeremy Quinn <je...@media.demon.co.uk> on 2000/05/31 10:56:32 UTC

Text Formatter woes

Hi All,

I am using the Text Formatter to output textstreams to SMIL. Specifically
QuickTime TextTracks.

They (should) look a bit like this:

{QTtext}{font:Helvetica}{size:20}{justify:left}{keyedText:on}{anti-alias:on}
{scrollIn:off}{scrollOut:off}{timeScale:10}{timeStamps:relative}
{textColor:65535,65535,65535}{width:520}{height:300}
[00:00:00.0]
{bold}Who am I?{plain}
- My name is {bold}Stefano Mazzocchi{plain}
- Pronounced: {bold}{italic}Stephan-O Madzock-key{plain}
- I'm Italian
- I'm a student
- I'm Cocoon's author and main architect
[00:00:10.0]
{bold}Ok, but what is Cocoon?{plain}
- A publishing framework
- A document generator
- A small revolution
[00:00:10.0]

etc.

My cocoon.properties are set thus:

formatter.type.text/plain       = org.apache.cocoon.formatter.TextFormatter

# TEXT/PLAIN
formatter.text/plain.preserve-space = true
formatter.text/plain.encoding = UTF-8
formatter.text/plain.indent = 0
formatter.text/plain.line-width = 400
formatter.text/plain.MIME-type = text/plain


The problem I am having is that the Formatter is indenting the output with
extra spaces at the beginning of the lines.

The relevant parts of the stylesheet look like this:

<xsl:template match="slides">
 <xsl:processing-instruction
name="cocoon-format">type="text/plain"</xsl:processing-instruction>
 <textstream><xml:text>&qtData;&qtText;&qtSlide;%0d&qtOpen;</xml:text>
  <xsl:apply-templates select="section[position()=$section]"/>
 </textstream>
</xsl:template>

<xsl:template match="slide">
<xsl:apply-templates/>
<xsl:text>&qtClose;</xsl:text>
</xsl:template>

<xsl:template
match="title"><xsl:text>{bold}</xsl:text><xsl:apply-templates/><xsl:text>{plain}</xsl:text></xsl:template>
<xsl:template match="li"><xsl:text>-
</xsl:text><xsl:apply-templates/></xsl:template>
<xsl:template
match="p"><xsl:text></xsl:text><xsl:apply-templates/></xsl:template>
<xsl:template
match="quote"><xsl:text>{italic}</xsl:text><xsl:apply-templates/><xsl:text>{plain}</xsl:text></xsl:template>
<xsl:template
match="source"><xsl:text>{font:Courier}</xsl:text><xsl:apply-templates/><xsl:text>{font:Helvetica}</xsl:text></xsl:template>
<xsl:template
match="em"><xsl:text>{bold}{italic}</xsl:text><xsl:apply-templates/><xsl:text>{plain}</xsl:text></xsl:template>
<xsl:template
match="strong"><xsl:text>{bold}</xsl:text><xsl:apply-templates/><xsl:text>{plain}</xsl:text></xsl:template>


The indentation follows the heirarchy of XSL tags, regardless of whitespace
in the sytlesheet.
I can only assume the whitespace is being added by the Formatter.

How can I turn this behaviour off?

Thanks for any help.

regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>