forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject cvs commit: xml-forrest/src/core/context/resources/schema catalog.xcat catalog
Date Tue, 13 Jan 2004 14:56:27 GMT
reinhard    2004/01/13 06:56:27

  Modified:    src/core/context sitemap.xmap forrest.xmap
               src/core/fresh-site/src/documentation/content/xdocs site.xml
               src/core/context/WEB-INF cocoon.xconf
               src/core/context/resources/schema catalog.xcat catalog
  Added:       src/core/context/resources/stylesheets
                        openoffice-writer2forrest.xsl
               src/core/context/resources/stylesheets/aggregates
                        openoffice-writer.xsl openoffice-writer.xml
               src/core/fresh-site/src/documentation/content/xdocs/samples
                        openoffice-writer.sxw
  Log:
  Support for Openoffice.org Writer files as sources:
   - sitemap enhancements
   - added sample file (for fresh projects)
   - stylesheet which transforms Openoffice into documentv12
     (not finished yet but will be improved in the future ...)
   - catalog entry for Openoffice doctyp
  
  Revision  Changes    Path
  1.7       +4 -1      xml-forrest/src/core/context/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/core/context/sitemap.xmap,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- sitemap.xmap	11 Jan 2004 23:56:39 -0000	1.6
  +++ sitemap.xmap	13 Jan 2004 14:56:27 -0000	1.7
  @@ -50,6 +50,7 @@
         </map:transformer>
   
         <map:transformer name="xpath" logger="sitemap.transformer.xpath" src="org.apache.cocoon.transformation.XPathTransformer"
/>
  +      
         <map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer"
logger="sitemap.transformer.xslt" pool-max="32" pool-min="8" pool-grow="2">
           <use-request-parameters>false</use-request-parameters>
           <use-browser-capabilities-db>false</use-browser-capabilities-db>
  @@ -60,6 +61,8 @@
         </map:transformer>
   
         <map:transformer name="xinclude" src="org.apache.cocoon.transformation.XIncludeTransformer"
logger="sitemap.transformer.xinclude" pool-grow="2" pool-max="16" pool-min="2" />
  +
  +      <map:transformer name="cinclude" pool-grow="2" pool-max="16" pool-min="2" src="org.apache.cocoon.transformation.CIncludeTransformer"
logger="sitemap.transformer.cinclude"/>
   
       </map:transformers>
   
  
  
  
  1.5       +16 -2     xml-forrest/src/core/context/forrest.xmap
  
  Index: forrest.xmap
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/core/context/forrest.xmap,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- forrest.xmap	28 Nov 2003 11:06:27 -0000	1.4
  +++ forrest.xmap	13 Jan 2004 14:56:27 -0000	1.5
  @@ -85,7 +85,7 @@
           </sourcetype>
           <sourcetype name="sdocbook-v1.0">
             <document-declaration public-id="-//OASIS//DTD Simplified DocBook XML V1.0//EN"
/>
  -        </sourcetype>
  +        </sourcetype>      
         </map:action>
       </map:actions>
       <map:selectors default="parameter">
  @@ -215,6 +215,20 @@
                 <map:serialize type="xml-document"/>
               </map:match>
             </map:when>
  +
  +          <map:when test="{project:content.xdocs}{1}.sxw">
  +            <map:match type="regexp" pattern="^(.*?)([^/]*).xml$">
  +              <map:generate src="{forrest:stylesheets}/aggregates/openoffice-writer.xml"/>
  +              <map:transform src="{forrest:stylesheets}/aggregates/openoffice-writer.xsl">
  +                <map:parameter name="src" value="{project:content.xdocs}{1}{2}.sxw"/>
  +              </map:transform>
  +              <map:transform type="cinclude"/>
  +              <map:transform src="{forrest:stylesheets}/openoffice-writer2forrest.xsl">
  +                <map:parameter name="filename" value="{2}" />
  +              </map:transform>
  +              <map:serialize type="xml-document"/>
  +            </map:match>
  +          </map:when>          
             
             <map:otherwise>
               <map:generate src="{project:content.xdocs}{1}.xml" />
  
  
  
  1.4       +3 -1      xml-forrest/src/core/fresh-site/src/documentation/content/xdocs/site.xml
  
  Index: site.xml
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/core/fresh-site/src/documentation/content/xdocs/site.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- site.xml	9 Dec 2003 02:00:36 -0000	1.3
  +++ site.xml	13 Jan 2004 14:56:27 -0000	1.4
  @@ -38,9 +38,11 @@
         description="Sample HTML page" />
       <sample-ascii-art label="ascii-art page" href="ascii-art.html" 
         description="Sample Ascii Art page" />
  +    <sample-openoffice-writer label="OpenOffice Writer" href="openoffice-writer.html"

  +      description="Openoffice Writer sample" />       
       <faq label="FAQ" href="faq.html" description="Frequently Asked Questions" />
       <sdocbook label="Simplifed Docbook" href="sdocbook.html" 
  -      description="Simplified DocBook example" />
  +      description="Simplified DocBook example" />     
       <subdir label="Subdir" href="subdir/">
         <index label="Index" href="index.html" 
           description="Page generated from a sub-directory"/>
  
  
  
  1.1                  xml-forrest/src/core/context/resources/stylesheets/openoffice-writer2forrest.xsl
  
  Index: openoffice-writer2forrest.xsl
  ===================================================================
  <?xml version="1.0" encoding="iso-8859-1"?>
  
  <xsl:stylesheet version="1.0" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text"
xmlns:office="http://openoffice.org/2000/office" xmlns:table="http://openoffice.org/2000/table"
xmlns:draw="http://openoffice.org/2000/drawing" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta"
xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg"
xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d"
xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form"
xmlns:script="http://openoffice.org/2000/script" xmlns:config="http://openoffice.org/2001/config"
office:class="text" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="office
meta  table number dc fo xlink chart math script xsl draw svg dr3d form config text style">
    <xsl:param name="filename"/>
    <xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
    <xsl:output method="xml" version="1.0" encoding="UTF-8" doctype-public="-//APACHE//DTD
Documentation V1.2//EN" doctype-system="http://apache.org/forrest/dtd/document-v12.dtd"/>
    <!--+
        | keys to generate the structure
        +-->
    <xsl:key name="rootChildren" match="draw:text-box | text:footnote-body | text:section
| text:p |table:table | text:span | text:ordered-list | office:annotation | text:unordered-list
| text:footnote | text:a | text:list-item | draw:plugin" use="generate-id((..|preceding-sibling::text:h[@text:level='1']|preceding-sibling::text:h[@text:level='2']|preceding-sibling::text:h[@text:level='3']|preceding-sibling::text:h[@text:level='4']|preceding-sibling::text:h[@text:level='5'])[last()])"/>
    <xsl:key name="chieldElements" match="text:h[@text:level &gt; '1' and @text:level
&lt;= '5']" use="generate-id(preceding-sibling::text:h[@text:level &lt; current()/@text:level][1])"/>
    <!--+
        | start transforming 
        +-->
    <xsl:template match="/">
      <document>
        <header>
          <title>
            <xsl:choose>
              <xsl:when test="/office:document/office:meta/dc:title = '' or not(/office:document/office:meta/dc:title)">
                <xsl:value-of select="$filename"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="/office:document/office:meta/dc:title"/>
              </xsl:otherwise>
            </xsl:choose>
          </title>
        </header>
        <xsl:apply-templates select="/*/office:body"/>
        <!--
        <completeDocForDebugging>
          <xsl:copy-of select="*"/>
        </completeDocForDebugging>
        -->
      </document>
    </xsl:template>
    <!--+
        | create the body 
        +-->
    <xsl:template match="office:body">
      <body>  
        <xsl:apply-templates select="key('rootChildren', generate-id())"/>
        <xsl:apply-templates select="text:h[@text:level='1']"/>      
      </body>
    </xsl:template>
    <!--+
        | headings
        +-->
    <xsl:template match="text:h[@text:level='1']">
      <xsl:call-template name="createSection">
        <xsl:with-param name="currentLevel" select="@text:level"/>
        <xsl:with-param name="prevLevel" select="1"/>
      </xsl:call-template>
    </xsl:template>
    <xsl:template match="text:h[@text:level='2'] | text:h[@text:level='3']| text:h[@text:level='4']
| text:h[@text:level='5']">
      <xsl:variable name="level" select="@text:level"/>
      <xsl:call-template name="createSection">
        <xsl:with-param name="currentLevel" select="$level"/>
        <xsl:with-param name="prevLevel" select="preceding-sibling::text:h[@text:level
&lt; $level][1]/@text:level "/>
      </xsl:call-template>
    </xsl:template>
    <xsl:template name="createSection">
      <xsl:param name="currentLevel"/>
      <xsl:param name="prevLevel"/>
      <xsl:choose>
        <xsl:when test="$currentLevel &gt; $prevLevel+1">
          <section>
            <title>hugo</title>
            <xsl:call-template name="createSection">
              <xsl:with-param name="currentLevel" select="$currentLevel"/>
              <xsl:with-param name="prevLevel" select="$prevLevel +1"/>
            </xsl:call-template>
          </section>
        </xsl:when>
        <xsl:otherwise>
          <section>
            <title>
              <xsl:apply-templates/>
            </title>
            <xsl:apply-templates select="key('rootChildren', generate-id())"/>
            <xsl:apply-templates select="key('chieldElements', generate-id())"/>
          </section>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
    <!--+
        | paragraph
        +-->
    <xsl:template match="text:p">
      <xsl:element name="p">
        <xsl:apply-templates/>
      </xsl:element>
    </xsl:template>
    <xsl:template match="text:p" mode="in-element">
      <xsl:apply-templates/>
    </xsl:template>  
    <!--+
        | strong emphasised text
        +-->
    <xsl:template match="text:span[@text:style-name='Strong Emphasis']">
      <strong>
        <xsl:apply-templates/>
      </strong>
    </xsl:template>
    <!--+
        | Images
        +-->
    <xsl:template match="draw:image[@xlink:show]">
      <img src="{@xlink:href}" alt="{@draw:name}"/>
    </xsl:template>
    <!--+
        | Inline Source
        +-->
    <xsl:template match="text:span[text:style-name='Code']">
      <code>
        <xsl:value-of select="."/>
      </code>
    </xsl:template>
    <!--+
        | line breaks 
        +-->
    <xsl:template match="text:line-break">
      <br/>
    </xsl:template>
    <!--+
        | lists
        +-->
    <xsl:template match="text:unordered-list">
      <ul>
        <xsl:apply-templates select="text:list-item"/>
      </ul>
    </xsl:template>
    <xsl:template match="text:ordered-list">
      <ol>
        <xsl:apply-templates select="text:list-item"/>
      </ol>
    </xsl:template>  
    <xsl:template match="text:list-item">
      <li>
        <xsl:apply-templates select="text:p" mode="in-element"/>
      </li>
      <xsl:apply-templates select="text:unordered-list"/>
      <xsl:apply-templates select="text:ordered-list"/>    
    </xsl:template>
    <!--+
        | Tables
        | Note (RP): need some improvement, maybe forrest-doc isn't good enough
        | for many talbe requirements ...
        +-->
    <xsl:template match="table:table">
      <table>
        <caption><xsl:value-of select="@table:name"/></caption>
        <xsl:apply-templates select="table:*"/>
      </table>
    </xsl:template>
    <xsl:template match="table:table-header-rows">
      <xsl:apply-templates select="table:table-row"/>
    </xsl:template>  
    <xsl:template match="table:table-row">
      <tr>
        <xsl:apply-templates select="table:table-cell"/>
      </tr>
    </xsl:template>
    <xsl:template match="table:table-header-rows/table:table-row/table:table-cell">
      <th>
        <xsl:apply-templates select="text:p" mode="in-element"/>
      </th>
    </xsl:template>  
    <xsl:template match="table:table-cell">
      <td>
        <xsl:apply-templates select="text:p" mode="in-element"/>
      </td>
    </xsl:template>
    <!--+
        | Images
        +-->
    
    <!--+
        | Links
        +-->
    <xsl:template match="text:a[not(@office:target-frame-name)]">
      <link href="{@xlink:href}" title="{@office:name}">
        <xsl:value-of select="."/>
      </link>
    </xsl:template>
    <xsl:template match="text:a[@office:target-frame-name='_top']">
      <jump href="{@xlink:href}" title="{@office:name}">
        <xsl:value-of select="."/>
      </jump>
    </xsl:template>  
    <xsl:template match="text:a">
      <fork href="{@xlink:href}" title="{@office:name}">
        <xsl:value-of select="."/>
      </fork>
    </xsl:template>  
    <!--+
        | Source
        +-->
    <xsl:template match="text:p[@text:style-name='Source']">
      <source>
  <xsl:text>
  </xsl:text>
        <xsl:apply-templates/>
  <xsl:text>
  </xsl:text>
     
      </source>
    </xsl:template>      
    <xsl:template match="text:p[@text:style-name='Source']/text:line-break">
      <br/>
    </xsl:template> 
    <!--+
        | Warning
        +-->
    <xsl:template match="text:p[@text:style-name='Warning']">
      <warning>
        <xsl:apply-templates/>
      </warning>
    </xsl:template>
    <!--+
        | Fixme
        | - the author attribute is ignored but this has to change with
        |   XHTML2 anyway ... (RP)
        +-->
    <xsl:template match="text:p[@text:style-name='Fixme']">
      <fixme>
        <xsl:apply-templates/>
      </fixme>
    </xsl:template>
    <!--+
        | Note
        +-->
    <xsl:template match="text:p[@text:style-name='Note']">
      <note>
        <xsl:apply-templates/>
      </note>
    </xsl:template>    
  </xsl:stylesheet>
  
  
  
  1.1                  xml-forrest/src/core/context/resources/stylesheets/aggregates/openoffice-writer.xsl
  
  Index: openoffice-writer.xsl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!-- OpenOffice Writer files are stored in .swx files which are 
       ZIP files. Content, style, meta, ... are stored
       n different files within these archives. In order to generate 
       *one* XML file containing all parts this aggregation using
       the CInclude-transformer is necessary.
       -->
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:param name="src"/>
    <xsl:template match="/">
      <office:document xmlns:c="http://apache.org/cocoon/include/1.0" 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"
xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:meta="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle"
xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d"
xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form"
xmlns:script="http://openoffice.org/2000/script" xmlns:config="http://openoffice.org/2001/config"
office:class="text" office:version="1.0">
        <c:include select="/*/*">
          <xsl:attribute name="src">zip://meta.xml@<xsl:value-of select="$src"/></xsl:attribute>
        </c:include>
        <c:include select="/*/*">
          <xsl:attribute name="src">zip://content.xml@<xsl:value-of select="$src"/></xsl:attribute>
        </c:include>      
      </office:document>
    </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  xml-forrest/src/core/context/resources/stylesheets/aggregates/openoffice-writer.xml
  
  Index: openoffice-writer.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <!-- only necessary to start the pipeline -->
  <openoffice/>
  
  
  
  1.1                  xml-forrest/src/core/fresh-site/src/documentation/content/xdocs/samples/openoffice-writer.sxw
  
  	<<Binary file>>
  
  
  1.4       +1 -0      xml-forrest/src/core/context/WEB-INF/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/core/context/WEB-INF/cocoon.xconf,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- cocoon.xconf	26 Nov 2003 09:15:32 -0000	1.3
  +++ cocoon.xconf	13 Jan 2004 14:56:27 -0000	1.4
  @@ -225,6 +225,7 @@
       <component-instance class="org.apache.excalibur.source.impl.ResourceSourceFactory"
name="resource"/>
       <component-instance class="org.apache.cocoon.components.source.impl.ContextSourceFactory"
name="context"/>
       <component-instance class="org.apache.cocoon.components.source.impl.SitemapSourceFactory"
name="cocoon"/>
  +    <component-instance class="org.apache.cocoon.components.source.impl.ZipSourceFactory"
name="zip"/>
       <!-- the "*" protocol handles all uri schemes that are not explicitely specified.
This includes all
            JDK standard protocols, with special handling of the "file:" protocol which is
modifiable
            (can be written to) and traversable (directory structures can be crawled). -->
  
  
  
  1.3       +12 -0     xml-forrest/src/core/context/resources/schema/catalog.xcat
  
  Index: catalog.xcat
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/core/context/resources/schema/catalog.xcat,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- catalog.xcat	28 Dec 2003 22:51:06 -0000	1.2
  +++ catalog.xcat	13 Jan 2004 14:56:27 -0000	1.3
  @@ -261,4 +261,16 @@
   <!-- End of catalog data for DocBook XML V4.1.2 ............................. -->
   <!-- ........................................................................ -->
   
  +
  +<!-- ...................................................................... -->
  +<!-- Catalog data for OpenOffice.org Documents 1.0 ........................ -->
  +
  +<!-- This is only a dummy file because Forrest can't include the original
  +     Openoffice.org DTD because it is published under the LGPL. -->     
  +<public publicId="-//OpenOffice.org//DTD OfficeDocument 1.0//EN"
  +        uri="open-office/dummy.dtd"/>
  +
  +<!-- End of catalog data for OpenOffice.org Documents 1.0 ................... -->
  +<!-- ........................................................................ -->
  +
   </catalog>
  
  
  
  1.3       +3 -0      xml-forrest/src/core/context/resources/schema/catalog
  
  Index: catalog
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/core/context/resources/schema/catalog,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- catalog	28 Dec 2003 22:51:06 -0000	1.2
  +++ catalog	13 Jan 2004 14:56:27 -0000	1.3
  @@ -278,3 +278,6 @@
   
     -- End of catalog data for DocBook XML V4.1.2 ........................... --
     -- ...................................................................... --
  +
  +-- Open Office Support --
  +PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "open-office/dummy.dtd"
  \ No newline at end of file
  
  
  

Mime
View raw message