You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Philippe Guillard <pg...@soociety.com> on 2004/02/26 18:46:58 UTC

OpenOfficeGeneration

Hi all,

Help about wiki page on OpenOfficeGeneration made by Yves Vindevogel. My
trouble is that cocoon renders my sxw files in plain text without
styling.

My question is: Where is made the link to the DTDs in
/resources/entities ? Don't find any in xsl stylesheets and pipeline
presented and i suppose this is what i'm missing. 

Note1: i copied the oo DTDs from windows since i was not able to find
them on my linux, and compared to what is said in the wiki page, i don't
have any catalog file :-(
Note2: i tried html.oowriter.xsl and standard oo transformation.

Thanks
Phil


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: OpenOfficeGeneration

Posted by Upayavira <uv...@upaya.co.uk>.
Yves Vindevogel wrote:

>Hmm, I see my name is this document since I wrote the original thing.
>I have never tested this on Cocoon 2.1.  But it seems David already answered
>this.
>I don't know whether I should revisit my code and update it for 2.1 ?
>  
>
If you can, please do.

>David: what's that about Forrest ?
>How will those two combine ?
>  
>
You might look into Forrest to see how they do it, but Cocoon needs this 
info for itself, regardless of what Forrest does.

Regards, Upayavira

>-----Original Message-----
>From: David Crossley [mailto:crossley@apache.org]
>Sent: vrijdag 27 februari 2004 0:43
>To: users cocoon
>Subject: Re: OpenOfficeGeneration
>
>
>Philippe Guillard wrote:
>  
>
>>Hi all,
>>
>>Help about wiki page on OpenOfficeGeneration made by Yves Vindevogel. My
>>trouble is that cocoon renders my sxw files in plain text without
>>styling.
>>
>>My question is: Where is made the link to the DTDs in
>>/resources/entities ? Don't find any in xsl stylesheets and pipeline
>>presented and i suppose this is what i'm missing.
>>
>>Note1: i copied the oo DTDs from windows since i was not able to find
>>them on my linux, and compared to what is said in the wiki page, i don't
>>have any catalog file :-(
>>    
>>
>
>Yes you do. It is distributed with Cocoon. You would need
>to add entries to it for your local ooffice DTDs.
>http://cocoon.apache.org/2.1/userdocs/concepts/catalog.html
>
>  
>
>>Note2: i tried html.oowriter.xsl and standard oo transformation.
>>    
>>
>
>There are the beginnings of some facilities at Apache Forrest for
>doing this.
>
>--David
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: OpenOfficeGeneration

Posted by Yves Vindevogel <yv...@implements.be>.
Hmm, I see my name is this document since I wrote the original thing.
I have never tested this on Cocoon 2.1.  But it seems David already answered
this.
I don't know whether I should revisit my code and update it for 2.1 ?

David: what's that about Forrest ?
How will those two combine ?

-----Original Message-----
From: David Crossley [mailto:crossley@apache.org]
Sent: vrijdag 27 februari 2004 0:43
To: users cocoon
Subject: Re: OpenOfficeGeneration


Philippe Guillard wrote:
> Hi all,
>
> Help about wiki page on OpenOfficeGeneration made by Yves Vindevogel. My
> trouble is that cocoon renders my sxw files in plain text without
> styling.
>
> My question is: Where is made the link to the DTDs in
> /resources/entities ? Don't find any in xsl stylesheets and pipeline
> presented and i suppose this is what i'm missing.
>
> Note1: i copied the oo DTDs from windows since i was not able to find
> them on my linux, and compared to what is said in the wiki page, i don't
> have any catalog file :-(

Yes you do. It is distributed with Cocoon. You would need
to add entries to it for your local ooffice DTDs.
http://cocoon.apache.org/2.1/userdocs/concepts/catalog.html

> Note2: i tried html.oowriter.xsl and standard oo transformation.

There are the beginnings of some facilities at Apache Forrest for
doing this.

--David



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: OpenOfficeGeneration

Posted by Philippe Guillard <pg...@soociety.com>.
Thanks all.

On Fri, 2004-02-27 at 21:44, Zamek wrote:
> Hello All,
> 
> I am new in Cocoon, but I have a working OO solving.
> 
> my sitemap.xmap snippet is:
> 
>   <map:match pattern="*.html">
>      <map:aggregate element="office:document">
>        <map:part src="zip://content.xml@{1}.sxw"/>
>        <map:part src="zip://meta.xml@{1}.sxw"/>
>        <map:part src="zip://styles.xml@{1}.sxw"/>
>      </map:aggregate>
> 
>      <map:transform src="style/ooo2html.xsl">
>        <map:parameter name="template" value="nomenu.xml"/>
>        <map:parameter name="doc_name" value="{1}"/>
>        <map:parameter name="metaFileURL" value="zip://meta.xml@{1}.sxw"/>
>        <map:parameter name="stylesFileURL" 
> value="zip://styles.xml@{1}.sxw"/>
>        <map:parameter name="absoluteSourceDirRef" value="{1}.sxw"/>
>      </map:transform>
>      <map:serialize type="html"/>
> 
>    </map:match>
> 
> my ooo2html.xsl is:
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsl:stylesheet version="1.0"
>                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
>                 xmlns:xlink="http://www.w3.org/1999/xlink"
>                 xmlns:svg="http://www.w3.org/2000/svg"
>                 xmlns:office="http://openoffice.org/2000/office"
>                 xmlns:style="http://openoffice.org/2000/style"
>                 xmlns:text="http://openoffice.org/2000/text"
>                 xmlns:table="http://openoffice.org/2000/table"
>                 xmlns:draw="http://openoffice.org/2000/drawing">
> 
> <!--
> XML Style Sheet for OpenOffice.org documents
> 
> When run through a XSLT processor, this style sheet will convert 
> OpenOffice.org XML
> documents to rather clean (X)HTML which will still be manually editable.
> 
> Written by Philipp "philiKON" von Weitershausen (philikon@philikon.de),
> published under the terms of the Mozilla Public License (MPL)
> 
> $Id: ooo2html.xsl,v 1.2 2004/02/15 09:09:25 zamek Exp zamek $
> -->
> 
>  <xsl:param name="doc_name"/>
>  <xsl:param name="template"/>
>  <xsl:variable name="content" select="/"/>
>  <xsl:variable name="layout" select="document( concat('../templates/',
> $template) )"/>
>  
> <xsl:output method="html" encoding="iso-8859-2"/>
> 
> <xsl:template match="/">
>   <xsl:apply-templates select="$layout/html"/>
>   <!-- xsl:apply-templates /-->
> </xsl:template>
> 
> <xsl:template match="insert-body">
>   <xsl:apply-templates select="$content/*"/>
> </xsl:template>
> 				
> 
> <!-- Text Content ... pages 123ff file format documentation-->
> 
> <!-- Paragraph -->
> <xsl:template match="//text:p">
> <p>
>   <xsl:if test="@text:style-name">            <!-- if this attribute is 
> there, it refers to a style definition -->
>     <xsl:call-template name="apply-style" />  <!-- thus, add CSS styles -->
>   </xsl:if>
>   <xsl:apply-templates />
> </p>
> </xsl:template>
> 
> 
> <!-- Space -->
> <xsl:template match="//text:s">
>   <xsl:for-each select="@text:c">   <!-- XXX range() function or 
> something... -->
>     <xsl:text>&#160;</xsl:text>
>   </xsl:for-each>
> </xsl:template>
> 
> 
> <!-- Tab Stop-->
> <xsl:template match="//text:tab-stop">
>   <xsl:text>	</xsl:text>
> </xsl:template>
> 
> 
> <!-- Span -->
> <xsl:template match="//text:span">
> <span>
>   <xsl:if test="@text:style-name">            <!-- if this attribute is 
> there, it refers to a style definition -->
>     <xsl:call-template name="apply-style" />  <!-- thus, add CSS styles -->
>   </xsl:if>
>   <xsl:apply-templates />
> </span>
> </xsl:template>
> 
> 
> <!-- Link -->
> <xsl:template match="//text:a">
> <a>
>   <xsl:attribute name="href"><xsl:value-of 
> select="@xlink:href" /></xsl:attribute>
>   <xsl:if test="@office:target-frame-name">
>    <xsl:attribute name="target"><xsl:value-of 
> select="@office:target-frame-name" /></xsl:attribute>
>   </xsl:if>
>   <xsl:apply-templates />
> </a>
> </xsl:template>
> 
> 
> <!-- Bookmark -->
> <xsl:template match="//text:bookmark">
> <a id="{@text:name}" />
> </xsl:template>
> 
> 
> <!-- Ordered List  -->
> <xsl:template match="//text:ordered-list">
> <ol>
>   <xsl:apply-templates />
> </ol>
> </xsl:template>
> 
> 
> <!-- Unordered List  -->
> <xsl:template match="//text:unordered-list">
> <ul>
>   <xsl:apply-templates />
> </ul>
> </xsl:template>
> 
> 
> <!-- Ordered List  -->
> <xsl:template match="//text:list-item">
> <li><xsl:apply-templates /></li>
> </xsl:template>
> 
> 
> <!-- Line break  -->
> <xsl:template match="//text:line-break">
> <br />
> </xsl:template>
> 
> 
> <!-- Table Content ... pages 261ff file format documentation-->
> 
> <!-- Table  -->
> <xsl:template match="//table:table">
> <table>
>   <xsl:if test="@table:style-name">            <!-- if this attribute is 
> there, it refers to a style definition -->
>     <xsl:call-template name="apply-style">     <!-- thus, add CSS styles -->
>       <xsl:with-param name="style-name" select="@table:style-name" />
>     </xsl:call-template>
>   </xsl:if>
>   <xsl:apply-templates />
> </table>
> </xsl:template>
> 
> 
> <!-- Table Header Rows -->
> <xsl:template match="//table:table-header-rows">
>   <xsl:apply-templates mode="header-row" />
> </xsl:template>
> 
> 
> <!-- Table Row -->
> <xsl:template match="//table:table-row">
> <tr>
>   <xsl:if test="@table:style-name">            <!-- if this attribute is 
> there, it refers to a style definition -->
>     <xsl:call-template name="apply-style">     <!-- thus, add CSS styles -->
>       <xsl:with-param name="style-name" select="@table:style-name" />
>     </xsl:call-template>
>   </xsl:if>
>   <xsl:apply-templates />
> </tr>
> </xsl:template>
> 
> <xsl:template match="table:covered-table-cell">
>   <xsl:apply-templates />
> </xsl:template>
> 
> <!-- Table Cell -->
> <xsl:template match="//table:table-cell">
>   <xsl:variable name="colspan" select="@table:number-columns-spanned"/>
>   <td colspan="{$colspan}">
>   <xsl:if test="@table:style-name">            <!-- if this attribute is 
> there, it refers to a style definition -->
>     <xsl:call-template name="apply-style">     <!-- thus, add CSS styles -->
>       <xsl:with-param name="style-name" select="@table:style-name" />
>     </xsl:call-template>
>   </xsl:if>
>   <xsl:apply-templates />
> </td>
> </xsl:template>
> 
> <xsl:template match="//table:table-cell" mode="header-row">
> <th>
>   <xsl:if test="@table:style-name">            <!-- if this attribute is 
> there, it refers to a style definition -->
>     <xsl:call-template name="apply-style">     <!-- thus, add CSS styles -->
>       <xsl:with-param name="style-name" select="@table:style-name" />
>     </xsl:call-template>
>   </xsl:if>
>   <xsl:apply-templates />
> </th>
> </xsl:template>
> 
> <!-- Draw Content ... pages 362ff file format documentation-->
> 
> <xsl:template match="//draw:image">
> <!--  <img alt="{@draw:name}" src="{@xlink:href}" /> -->
>   <img alt="{@draw:name}" 
> src="{$doc_name}/{substring-after(@xlink:href,'#Pictures/')}"/>
> </xsl:template>
> 
> <!-- Styles ... used everywhere -->
> 
> <xsl:template name="apply-style">
>   <!-- This template is called by text:p and text:span templates in order to
>        insert a style attribute with CSS styles -->
>   <xsl:param name="style-name" select="@text:style-name" />
>   <xsl:attribute name="style">
>     <xsl:apply-templates 
> select="//style:style[@style:name=$style-name]/style:properties/@*" 
> mode="style" />
>   </xsl:attribute>
> </xsl:template>
> 
> 
> <!-- Format Attributes -->
> <xsl:template match="@fo:*|@style:width" mode="style">
>   <!-- The following attributes in the XSL format (fo) namespace are used by 
> OpenOffice.org
>        but don't seem to be part of CSS. This may lead to not 100% valid 
> CSS.
>        * language
>        * country
>        * text-shadow
>        * text-align-last
>        * hyphenate
>        * hyphenation-keep
>        * hyphenation-remain-char-count
>        * hyphenation-push-char-count
>        * hyphenation-ladder-count
>        * break-before
>        * break-after
>   -->
>   <xsl:value-of select="local-name()" /><xsl:text>:</xsl:text><xsl:value-of 
> select="." /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@fo:text-align" mode="style">
>   <xsl:if test=".='start'"   >text-align:left; </xsl:if>
>   <xsl:if test=".='center'"  >text-align:center; </xsl:if>
>   <xsl:if test=".='end'"     >text-align:right; </xsl:if>
>   <xsl:if test=".='justify'" >text-align:justify; </xsl:if>
> </xsl:template>
> 
> 
> <!-- Style Attributes -->
> <xsl:template match="@style:font-name" mode="style">
>   <xsl:text>font-family:</xsl:text><xsl:value-of 
> select="local-name()" /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:text-underline" mode="style">
>   <xsl:text>text-decoration:underline; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:text-crossing-out" mode="style">
>   <xsl:text>text-decoration:line-through; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:text-blinking" mode="style">
>   <xsl:text>text-decoration:blink; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:text-background-color" mode="style">
>   <xsl:text>background-color:</xsl:text><xsl:value-of 
> select="." /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:border-line-width" mode="style">
>   <xsl:text>border-width:</xsl:text><xsl:value-of select="." /><xsl:text>; 
> </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:border-line-width-top" mode="style">
>   <xsl:text>border-top-width:</xsl:text><xsl:value-of 
> select="." /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:border-line-width-bottom" mode="style">
>   <xsl:text>border-bottom-width:</xsl:text><xsl:value-of 
> select="." /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:border-line-width-left" mode="style">
>   <xsl:text>border-left-width:</xsl:text><xsl:value-of 
> select="." /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:border-line-width-right" mode="style">
>   <xsl:text>border-right-width:</xsl:text><xsl:value-of 
> select="." /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <!-- we need this, otherwise the processor will just print the attribute
>      contents while we want unmatched attributes not to appear -->
> <!-- xsl:template match="@*" mode="style" / -->
> 
> <xsl:template match="@*|*">
>   <xsl:copy>
>     <xsl:apply-templates select="@*|node()"/>
>   </xsl:copy>
> </xsl:template>
> 					
> 
> </xsl:stylesheet>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: OpenOfficeGeneration

Posted by Philippe Guillard <pg...@soociety.com>.
Hi Zamek,

Sorry to bother you, can you tell me or send what is nomenu.xml
mentioned in your response below ?

Your xsl looks good and i become lazy! Thanks.

Phil


On Fri, 2004-02-27 at 21:44, Zamek wrote:
> Hello All,
> 
> I am new in Cocoon, but I have a working OO solving.
> 
> my sitemap.xmap snippet is:
> 
>   <map:match pattern="*.html">
>      <map:aggregate element="office:document">
>        <map:part src="zip://content.xml@{1}.sxw"/>
>        <map:part src="zip://meta.xml@{1}.sxw"/>
>        <map:part src="zip://styles.xml@{1}.sxw"/>
>      </map:aggregate>
> 
>      <map:transform src="style/ooo2html.xsl">
>        <map:parameter name="template" value="nomenu.xml"/>
>        <map:parameter name="doc_name" value="{1}"/>
>        <map:parameter name="metaFileURL" value="zip://meta.xml@{1}.sxw"/>
>        <map:parameter name="stylesFileURL" 
> value="zip://styles.xml@{1}.sxw"/>
>        <map:parameter name="absoluteSourceDirRef" value="{1}.sxw"/>
>      </map:transform>
>      <map:serialize type="html"/>
> 
>    </map:match>
> 
> my ooo2html.xsl is:
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsl:stylesheet version="1.0"
>                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
>                 xmlns:xlink="http://www.w3.org/1999/xlink"
>                 xmlns:svg="http://www.w3.org/2000/svg"
>                 xmlns:office="http://openoffice.org/2000/office"
>                 xmlns:style="http://openoffice.org/2000/style"
>                 xmlns:text="http://openoffice.org/2000/text"
>                 xmlns:table="http://openoffice.org/2000/table"
>                 xmlns:draw="http://openoffice.org/2000/drawing">
> 
> <!--
> XML Style Sheet for OpenOffice.org documents
> 
> When run through a XSLT processor, this style sheet will convert 
> OpenOffice.org XML
> documents to rather clean (X)HTML which will still be manually editable.
> 
> Written by Philipp "philiKON" von Weitershausen (philikon@philikon.de),
> published under the terms of the Mozilla Public License (MPL)
> 
> $Id: ooo2html.xsl,v 1.2 2004/02/15 09:09:25 zamek Exp zamek $
> -->
> 
>  <xsl:param name="doc_name"/>
>  <xsl:param name="template"/>
>  <xsl:variable name="content" select="/"/>
>  <xsl:variable name="layout" select="document( concat('../templates/',
> $template) )"/>
>  
> <xsl:output method="html" encoding="iso-8859-2"/>
> 
> <xsl:template match="/">
>   <xsl:apply-templates select="$layout/html"/>
>   <!-- xsl:apply-templates /-->
> </xsl:template>
> 
> <xsl:template match="insert-body">
>   <xsl:apply-templates select="$content/*"/>
> </xsl:template>
> 				
> 
> <!-- Text Content ... pages 123ff file format documentation-->
> 
> <!-- Paragraph -->
> <xsl:template match="//text:p">
> <p>
>   <xsl:if test="@text:style-name">            <!-- if this attribute is 
> there, it refers to a style definition -->
>     <xsl:call-template name="apply-style" />  <!-- thus, add CSS styles -->
>   </xsl:if>
>   <xsl:apply-templates />
> </p>
> </xsl:template>
> 
> 
> <!-- Space -->
> <xsl:template match="//text:s">
>   <xsl:for-each select="@text:c">   <!-- XXX range() function or 
> something... -->
>     <xsl:text>&#160;</xsl:text>
>   </xsl:for-each>
> </xsl:template>
> 
> 
> <!-- Tab Stop-->
> <xsl:template match="//text:tab-stop">
>   <xsl:text>	</xsl:text>
> </xsl:template>
> 
> 
> <!-- Span -->
> <xsl:template match="//text:span">
> <span>
>   <xsl:if test="@text:style-name">            <!-- if this attribute is 
> there, it refers to a style definition -->
>     <xsl:call-template name="apply-style" />  <!-- thus, add CSS styles -->
>   </xsl:if>
>   <xsl:apply-templates />
> </span>
> </xsl:template>
> 
> 
> <!-- Link -->
> <xsl:template match="//text:a">
> <a>
>   <xsl:attribute name="href"><xsl:value-of 
> select="@xlink:href" /></xsl:attribute>
>   <xsl:if test="@office:target-frame-name">
>    <xsl:attribute name="target"><xsl:value-of 
> select="@office:target-frame-name" /></xsl:attribute>
>   </xsl:if>
>   <xsl:apply-templates />
> </a>
> </xsl:template>
> 
> 
> <!-- Bookmark -->
> <xsl:template match="//text:bookmark">
> <a id="{@text:name}" />
> </xsl:template>
> 
> 
> <!-- Ordered List  -->
> <xsl:template match="//text:ordered-list">
> <ol>
>   <xsl:apply-templates />
> </ol>
> </xsl:template>
> 
> 
> <!-- Unordered List  -->
> <xsl:template match="//text:unordered-list">
> <ul>
>   <xsl:apply-templates />
> </ul>
> </xsl:template>
> 
> 
> <!-- Ordered List  -->
> <xsl:template match="//text:list-item">
> <li><xsl:apply-templates /></li>
> </xsl:template>
> 
> 
> <!-- Line break  -->
> <xsl:template match="//text:line-break">
> <br />
> </xsl:template>
> 
> 
> <!-- Table Content ... pages 261ff file format documentation-->
> 
> <!-- Table  -->
> <xsl:template match="//table:table">
> <table>
>   <xsl:if test="@table:style-name">            <!-- if this attribute is 
> there, it refers to a style definition -->
>     <xsl:call-template name="apply-style">     <!-- thus, add CSS styles -->
>       <xsl:with-param name="style-name" select="@table:style-name" />
>     </xsl:call-template>
>   </xsl:if>
>   <xsl:apply-templates />
> </table>
> </xsl:template>
> 
> 
> <!-- Table Header Rows -->
> <xsl:template match="//table:table-header-rows">
>   <xsl:apply-templates mode="header-row" />
> </xsl:template>
> 
> 
> <!-- Table Row -->
> <xsl:template match="//table:table-row">
> <tr>
>   <xsl:if test="@table:style-name">            <!-- if this attribute is 
> there, it refers to a style definition -->
>     <xsl:call-template name="apply-style">     <!-- thus, add CSS styles -->
>       <xsl:with-param name="style-name" select="@table:style-name" />
>     </xsl:call-template>
>   </xsl:if>
>   <xsl:apply-templates />
> </tr>
> </xsl:template>
> 
> <xsl:template match="table:covered-table-cell">
>   <xsl:apply-templates />
> </xsl:template>
> 
> <!-- Table Cell -->
> <xsl:template match="//table:table-cell">
>   <xsl:variable name="colspan" select="@table:number-columns-spanned"/>
>   <td colspan="{$colspan}">
>   <xsl:if test="@table:style-name">            <!-- if this attribute is 
> there, it refers to a style definition -->
>     <xsl:call-template name="apply-style">     <!-- thus, add CSS styles -->
>       <xsl:with-param name="style-name" select="@table:style-name" />
>     </xsl:call-template>
>   </xsl:if>
>   <xsl:apply-templates />
> </td>
> </xsl:template>
> 
> <xsl:template match="//table:table-cell" mode="header-row">
> <th>
>   <xsl:if test="@table:style-name">            <!-- if this attribute is 
> there, it refers to a style definition -->
>     <xsl:call-template name="apply-style">     <!-- thus, add CSS styles -->
>       <xsl:with-param name="style-name" select="@table:style-name" />
>     </xsl:call-template>
>   </xsl:if>
>   <xsl:apply-templates />
> </th>
> </xsl:template>
> 
> <!-- Draw Content ... pages 362ff file format documentation-->
> 
> <xsl:template match="//draw:image">
> <!--  <img alt="{@draw:name}" src="{@xlink:href}" /> -->
>   <img alt="{@draw:name}" 
> src="{$doc_name}/{substring-after(@xlink:href,'#Pictures/')}"/>
> </xsl:template>
> 
> <!-- Styles ... used everywhere -->
> 
> <xsl:template name="apply-style">
>   <!-- This template is called by text:p and text:span templates in order to
>        insert a style attribute with CSS styles -->
>   <xsl:param name="style-name" select="@text:style-name" />
>   <xsl:attribute name="style">
>     <xsl:apply-templates 
> select="//style:style[@style:name=$style-name]/style:properties/@*" 
> mode="style" />
>   </xsl:attribute>
> </xsl:template>
> 
> 
> <!-- Format Attributes -->
> <xsl:template match="@fo:*|@style:width" mode="style">
>   <!-- The following attributes in the XSL format (fo) namespace are used by 
> OpenOffice.org
>        but don't seem to be part of CSS. This may lead to not 100% valid 
> CSS.
>        * language
>        * country
>        * text-shadow
>        * text-align-last
>        * hyphenate
>        * hyphenation-keep
>        * hyphenation-remain-char-count
>        * hyphenation-push-char-count
>        * hyphenation-ladder-count
>        * break-before
>        * break-after
>   -->
>   <xsl:value-of select="local-name()" /><xsl:text>:</xsl:text><xsl:value-of 
> select="." /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@fo:text-align" mode="style">
>   <xsl:if test=".='start'"   >text-align:left; </xsl:if>
>   <xsl:if test=".='center'"  >text-align:center; </xsl:if>
>   <xsl:if test=".='end'"     >text-align:right; </xsl:if>
>   <xsl:if test=".='justify'" >text-align:justify; </xsl:if>
> </xsl:template>
> 
> 
> <!-- Style Attributes -->
> <xsl:template match="@style:font-name" mode="style">
>   <xsl:text>font-family:</xsl:text><xsl:value-of 
> select="local-name()" /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:text-underline" mode="style">
>   <xsl:text>text-decoration:underline; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:text-crossing-out" mode="style">
>   <xsl:text>text-decoration:line-through; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:text-blinking" mode="style">
>   <xsl:text>text-decoration:blink; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:text-background-color" mode="style">
>   <xsl:text>background-color:</xsl:text><xsl:value-of 
> select="." /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:border-line-width" mode="style">
>   <xsl:text>border-width:</xsl:text><xsl:value-of select="." /><xsl:text>; 
> </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:border-line-width-top" mode="style">
>   <xsl:text>border-top-width:</xsl:text><xsl:value-of 
> select="." /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:border-line-width-bottom" mode="style">
>   <xsl:text>border-bottom-width:</xsl:text><xsl:value-of 
> select="." /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:border-line-width-left" mode="style">
>   <xsl:text>border-left-width:</xsl:text><xsl:value-of 
> select="." /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <xsl:template match="@style:border-line-width-right" mode="style">
>   <xsl:text>border-right-width:</xsl:text><xsl:value-of 
> select="." /><xsl:text>; </xsl:text>
> </xsl:template>
> 
> <!-- we need this, otherwise the processor will just print the attribute
>      contents while we want unmatched attributes not to appear -->
> <!-- xsl:template match="@*" mode="style" / -->
> 
> <xsl:template match="@*|*">
>   <xsl:copy>
>     <xsl:apply-templates select="@*|node()"/>
>   </xsl:copy>
> </xsl:template>
> 					
> 
> </xsl:stylesheet>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: OpenOfficeGeneration

Posted by Zamek <za...@vili.pmmf.hu>.
Hello All,

I am new in Cocoon, but I have a working OO solving.

my sitemap.xmap snippet is:

  <map:match pattern="*.html">
     <map:aggregate element="office:document">
       <map:part src="zip://content.xml@{1}.sxw"/>
       <map:part src="zip://meta.xml@{1}.sxw"/>
       <map:part src="zip://styles.xml@{1}.sxw"/>
     </map:aggregate>

     <map:transform src="style/ooo2html.xsl">
       <map:parameter name="template" value="nomenu.xml"/>
       <map:parameter name="doc_name" value="{1}"/>
       <map:parameter name="metaFileURL" value="zip://meta.xml@{1}.sxw"/>
       <map:parameter name="stylesFileURL" 
value="zip://styles.xml@{1}.sxw"/>
       <map:parameter name="absoluteSourceDirRef" value="{1}.sxw"/>
     </map:transform>
     <map:serialize type="html"/>

   </map:match>

my ooo2html.xsl is:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:fo="http://www.w3.org/1999/XSL/Format"
                xmlns:xlink="http://www.w3.org/1999/xlink"
                xmlns:svg="http://www.w3.org/2000/svg"
                xmlns:office="http://openoffice.org/2000/office"
                xmlns:style="http://openoffice.org/2000/style"
                xmlns:text="http://openoffice.org/2000/text"
                xmlns:table="http://openoffice.org/2000/table"
                xmlns:draw="http://openoffice.org/2000/drawing">

<!--
XML Style Sheet for OpenOffice.org documents

When run through a XSLT processor, this style sheet will convert 
OpenOffice.org XML
documents to rather clean (X)HTML which will still be manually editable.

Written by Philipp "philiKON" von Weitershausen (philikon@philikon.de),
published under the terms of the Mozilla Public License (MPL)

$Id: ooo2html.xsl,v 1.2 2004/02/15 09:09:25 zamek Exp zamek $
-->

 <xsl:param name="doc_name"/>
 <xsl:param name="template"/>
 <xsl:variable name="content" select="/"/>
 <xsl:variable name="layout" select="document( concat('../templates/',
$template) )"/>
 
<xsl:output method="html" encoding="iso-8859-2"/>

<xsl:template match="/">
  <xsl:apply-templates select="$layout/html"/>
  <!-- xsl:apply-templates /-->
</xsl:template>

<xsl:template match="insert-body">
  <xsl:apply-templates select="$content/*"/>
</xsl:template>
				

<!-- Text Content ... pages 123ff file format documentation-->

<!-- Paragraph -->
<xsl:template match="//text:p">
<p>
  <xsl:if test="@text:style-name">            <!-- if this attribute is 
there, it refers to a style definition -->
    <xsl:call-template name="apply-style" />  <!-- thus, add CSS styles -->
  </xsl:if>
  <xsl:apply-templates />
</p>
</xsl:template>


<!-- Space -->
<xsl:template match="//text:s">
  <xsl:for-each select="@text:c">   <!-- XXX range() function or 
something... -->
    <xsl:text>&#160;</xsl:text>
  </xsl:for-each>
</xsl:template>


<!-- Tab Stop-->
<xsl:template match="//text:tab-stop">
  <xsl:text>	</xsl:text>
</xsl:template>


<!-- Span -->
<xsl:template match="//text:span">
<span>
  <xsl:if test="@text:style-name">            <!-- if this attribute is 
there, it refers to a style definition -->
    <xsl:call-template name="apply-style" />  <!-- thus, add CSS styles -->
  </xsl:if>
  <xsl:apply-templates />
</span>
</xsl:template>


<!-- Link -->
<xsl:template match="//text:a">
<a>
  <xsl:attribute name="href"><xsl:value-of 
select="@xlink:href" /></xsl:attribute>
  <xsl:if test="@office:target-frame-name">
   <xsl:attribute name="target"><xsl:value-of 
select="@office:target-frame-name" /></xsl:attribute>
  </xsl:if>
  <xsl:apply-templates />
</a>
</xsl:template>


<!-- Bookmark -->
<xsl:template match="//text:bookmark">
<a id="{@text:name}" />
</xsl:template>


<!-- Ordered List  -->
<xsl:template match="//text:ordered-list">
<ol>
  <xsl:apply-templates />
</ol>
</xsl:template>


<!-- Unordered List  -->
<xsl:template match="//text:unordered-list">
<ul>
  <xsl:apply-templates />
</ul>
</xsl:template>


<!-- Ordered List  -->
<xsl:template match="//text:list-item">
<li><xsl:apply-templates /></li>
</xsl:template>


<!-- Line break  -->
<xsl:template match="//text:line-break">
<br />
</xsl:template>


<!-- Table Content ... pages 261ff file format documentation-->

<!-- Table  -->
<xsl:template match="//table:table">
<table>
  <xsl:if test="@table:style-name">            <!-- if this attribute is 
there, it refers to a style definition -->
    <xsl:call-template name="apply-style">     <!-- thus, add CSS styles -->
      <xsl:with-param name="style-name" select="@table:style-name" />
    </xsl:call-template>
  </xsl:if>
  <xsl:apply-templates />
</table>
</xsl:template>


<!-- Table Header Rows -->
<xsl:template match="//table:table-header-rows">
  <xsl:apply-templates mode="header-row" />
</xsl:template>


<!-- Table Row -->
<xsl:template match="//table:table-row">
<tr>
  <xsl:if test="@table:style-name">            <!-- if this attribute is 
there, it refers to a style definition -->
    <xsl:call-template name="apply-style">     <!-- thus, add CSS styles -->
      <xsl:with-param name="style-name" select="@table:style-name" />
    </xsl:call-template>
  </xsl:if>
  <xsl:apply-templates />
</tr>
</xsl:template>

<xsl:template match="table:covered-table-cell">
  <xsl:apply-templates />
</xsl:template>

<!-- Table Cell -->
<xsl:template match="//table:table-cell">
  <xsl:variable name="colspan" select="@table:number-columns-spanned"/>
  <td colspan="{$colspan}">
  <xsl:if test="@table:style-name">            <!-- if this attribute is 
there, it refers to a style definition -->
    <xsl:call-template name="apply-style">     <!-- thus, add CSS styles -->
      <xsl:with-param name="style-name" select="@table:style-name" />
    </xsl:call-template>
  </xsl:if>
  <xsl:apply-templates />
</td>
</xsl:template>

<xsl:template match="//table:table-cell" mode="header-row">
<th>
  <xsl:if test="@table:style-name">            <!-- if this attribute is 
there, it refers to a style definition -->
    <xsl:call-template name="apply-style">     <!-- thus, add CSS styles -->
      <xsl:with-param name="style-name" select="@table:style-name" />
    </xsl:call-template>
  </xsl:if>
  <xsl:apply-templates />
</th>
</xsl:template>

<!-- Draw Content ... pages 362ff file format documentation-->

<xsl:template match="//draw:image">
<!--  <img alt="{@draw:name}" src="{@xlink:href}" /> -->
  <img alt="{@draw:name}" 
src="{$doc_name}/{substring-after(@xlink:href,'#Pictures/')}"/>
</xsl:template>

<!-- Styles ... used everywhere -->

<xsl:template name="apply-style">
  <!-- This template is called by text:p and text:span templates in order to
       insert a style attribute with CSS styles -->
  <xsl:param name="style-name" select="@text:style-name" />
  <xsl:attribute name="style">
    <xsl:apply-templates 
select="//style:style[@style:name=$style-name]/style:properties/@*" 
mode="style" />
  </xsl:attribute>
</xsl:template>


<!-- Format Attributes -->
<xsl:template match="@fo:*|@style:width" mode="style">
  <!-- The following attributes in the XSL format (fo) namespace are used by 
OpenOffice.org
       but don't seem to be part of CSS. This may lead to not 100% valid 
CSS.
       * language
       * country
       * text-shadow
       * text-align-last
       * hyphenate
       * hyphenation-keep
       * hyphenation-remain-char-count
       * hyphenation-push-char-count
       * hyphenation-ladder-count
       * break-before
       * break-after
  -->
  <xsl:value-of select="local-name()" /><xsl:text>:</xsl:text><xsl:value-of 
select="." /><xsl:text>; </xsl:text>
</xsl:template>

<xsl:template match="@fo:text-align" mode="style">
  <xsl:if test=".='start'"   >text-align:left; </xsl:if>
  <xsl:if test=".='center'"  >text-align:center; </xsl:if>
  <xsl:if test=".='end'"     >text-align:right; </xsl:if>
  <xsl:if test=".='justify'" >text-align:justify; </xsl:if>
</xsl:template>


<!-- Style Attributes -->
<xsl:template match="@style:font-name" mode="style">
  <xsl:text>font-family:</xsl:text><xsl:value-of 
select="local-name()" /><xsl:text>; </xsl:text>
</xsl:template>

<xsl:template match="@style:text-underline" mode="style">
  <xsl:text>text-decoration:underline; </xsl:text>
</xsl:template>

<xsl:template match="@style:text-crossing-out" mode="style">
  <xsl:text>text-decoration:line-through; </xsl:text>
</xsl:template>

<xsl:template match="@style:text-blinking" mode="style">
  <xsl:text>text-decoration:blink; </xsl:text>
</xsl:template>

<xsl:template match="@style:text-background-color" mode="style">
  <xsl:text>background-color:</xsl:text><xsl:value-of 
select="." /><xsl:text>; </xsl:text>
</xsl:template>

<xsl:template match="@style:border-line-width" mode="style">
  <xsl:text>border-width:</xsl:text><xsl:value-of select="." /><xsl:text>; 
</xsl:text>
</xsl:template>

<xsl:template match="@style:border-line-width-top" mode="style">
  <xsl:text>border-top-width:</xsl:text><xsl:value-of 
select="." /><xsl:text>; </xsl:text>
</xsl:template>

<xsl:template match="@style:border-line-width-bottom" mode="style">
  <xsl:text>border-bottom-width:</xsl:text><xsl:value-of 
select="." /><xsl:text>; </xsl:text>
</xsl:template>

<xsl:template match="@style:border-line-width-left" mode="style">
  <xsl:text>border-left-width:</xsl:text><xsl:value-of 
select="." /><xsl:text>; </xsl:text>
</xsl:template>

<xsl:template match="@style:border-line-width-right" mode="style">
  <xsl:text>border-right-width:</xsl:text><xsl:value-of 
select="." /><xsl:text>; </xsl:text>
</xsl:template>

<!-- we need this, otherwise the processor will just print the attribute
     contents while we want unmatched attributes not to appear -->
<!-- xsl:template match="@*" mode="style" / -->

<xsl:template match="@*|*">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>
					

</xsl:stylesheet>

-- 
by,
Zoltan Zidarics programmer
PTE University Pecs, Hungary
icq: 43288694


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: OpenOfficeGeneration

Posted by Reinhard Poetz <re...@apache.org>.
From: David Crossley [mailto:crossley@apache.org] 

> Philippe Guillard wrote:
> > Hi all,
> > 
> > Help about wiki page on OpenOfficeGeneration made by Yves 
> Vindevogel. 
> > My trouble is that cocoon renders my sxw files in plain 
> text without 
> > styling.
> > 
> > My question is: Where is made the link to the DTDs in 
> > /resources/entities ? Don't find any in xsl stylesheets and 
> pipeline 
> > presented and i suppose this is what i'm missing.
> > 
> > Note1: i copied the oo DTDs from windows since i was not 
> able to find 
> > them on my linux, and compared to what is said in the wiki page, i 
> > don't have any catalog file :-(
> 
> Yes you do. It is distributed with Cocoon. You would need
> to add entries to it for your local ooffice DTDs. 
> http://cocoon.apache.org/2.1/userdocs/c> oncepts/catalog.html
> 
> 
> > Note2: i tried html.oowriter.xsl and 
> standard oo transformation.
> 
> There are the beginnings of some facilities at Apache Forrest 
> for doing this.

You can find examples in Forrest (create a new project using latest CVS)
and in Cocoon (see Scratchpad and ZIP sources).
Forrest also contains a stylesheet which transforms Openoffice docs in
documentv12.

HTH

--
Reinhard


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: OpenOfficeGeneration

Posted by David Crossley <cr...@apache.org>.
Philippe Guillard wrote:
> Hi all,
> 
> Help about wiki page on OpenOfficeGeneration made by Yves Vindevogel. My
> trouble is that cocoon renders my sxw files in plain text without
> styling.
> 
> My question is: Where is made the link to the DTDs in
> /resources/entities ? Don't find any in xsl stylesheets and pipeline
> presented and i suppose this is what i'm missing. 
> 
> Note1: i copied the oo DTDs from windows since i was not able to find
> them on my linux, and compared to what is said in the wiki page, i don't
> have any catalog file :-(

Yes you do. It is distributed with Cocoon. You would need
to add entries to it for your local ooffice DTDs.
http://cocoon.apache.org/2.1/userdocs/concepts/catalog.html

> Note2: i tried html.oowriter.xsl and standard oo transformation.

There are the beginnings of some facilities at Apache Forrest for
doing this.

--David



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org