You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@forrest.apache.org by "Johnson, Eric" <Er...@iona.com> on 2006/05/15 17:25:51 UTC

Using Docbook

I'm trying to use docbook files as part of the source to Forrest (v7.0).
I want to be able to use docbook and document v2.0. I've tried to get a
match and transform working, but to date all I can get is an empty html
file as output.

Here is the match from my projects sitemap.xml:

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

  <map:components>
    <map:actions>
      <map:action logger="sitemap.action.sourcetype" name="sourcetype"
src="org.apache.forrest.sourcetype.SourceTypeAction">
        <sourcetype name="docbook-v4.1.2">
		  <document-declaration public-id="-//OASIS//DTD DocBook
XML V4.1.2//EN" />
		</sourcetype>      
      </map:action>
    </map:actions>   
    
    <map:selectors default="parameter">
	    <map:selector logger="sitemap.selector.parameter"
name="parameter" src="org.apache.cocoon.selection.ParameterSelector" />
    </map:selectors>
  </map:components>
  
  <map:resources>    
  </map:resources>
  
 <map:pipelines>
  <map:pipeline>
    <map:match pattern="old_site/*.html">
     <map:select type="exists">
      <map:when test="{project:content}{1}.html">
        <map:read src="{project:content}{1}.html"
mime-type="text/html"/>
        <!--
          Use this instead if you want JTidy to clean up your HTML
          <map:generate type="html" src="{project:content}/{0}" />
          <map:serialize type="html"/>
        -->
      </map:when>
     </map:select>
   </map:match>
  
   <map:match pattern="**.xml">
     <map:act type="sourcetype" src="{project:content.xdocs}{1}.xml">
     <map:select type="parameter">
      <map:parameter name="parameter-selector-test" value="{sourcetype}"
/>
      <map:when test="docbook-v4.1.2">
	    <map:generate src="{project:content.xdocs}{1}.xml" />
        <map:transform
src="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
" />
      </map:when>
     </map:select>
    </map:act>
   </map:match>
  </map:pipeline>
 </map:pipelines>
</map:sitemap>

Any help would be great!!

Thanks,
Eric


Re: Using Docbook

Posted by Johannes Schaefer <jo...@uidesign.de>.
Hi!

There also exists a (s)docbook-plugin for Forrest,
(org.apache.forrest.plugin.input.simplifiedDocbook).
It does not support all of (s)Docbook but we use it successfully.

See:
  http://forrest.apache.org/pluginDocs/plugins_0_70/index.html
  http://forrest.apache.org/pluginDocs/plugins_0_70/usingPlugins.html

Cheers
Johannes


Brian M Dube wrote:
> Johnson, Eric wrote:
>> I'm trying to use docbook files as part of the source to Forrest (v7.0).
>> I want to be able to use docbook and document v2.0. I've tried to get a
>> match and transform working, but to date all I can get is an empty html
>> file as output.
>>
>> Here is the match from my projects sitemap.xml:
>>
>> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
>>
>>   <map:components>
>>     <map:actions>
>>       <map:action logger="sitemap.action.sourcetype" name="sourcetype"
>> src="org.apache.forrest.sourcetype.SourceTypeAction">
>>         <sourcetype name="docbook-v4.1.2">
>>           <document-declaration public-id="-//OASIS//DTD DocBook
>> XML V4.1.2//EN" />
>>         </sourcetype>            </map:action>
>>     </map:actions>           <map:selectors default="parameter">
>>         <map:selector logger="sitemap.selector.parameter"
>> name="parameter" src="org.apache.cocoon.selection.ParameterSelector" />
>>     </map:selectors>
>>   </map:components>
>>     <map:resources>      </map:resources>
>>    <map:pipelines>
>>   <map:pipeline>
>>     <map:match pattern="old_site/*.html">
>>      <map:select type="exists">
>>       <map:when test="{project:content}{1}.html">
>>         <map:read src="{project:content}{1}.html"
>> mime-type="text/html"/>
>>         <!--
>>           Use this instead if you want JTidy to clean up your HTML
>>           <map:generate type="html" src="{project:content}/{0}" />
>>           <map:serialize type="html"/>
>>         -->
>>       </map:when>
>>      </map:select>
>>    </map:match>
>>      <map:match pattern="**.xml">
>>      <map:act type="sourcetype" src="{project:content.xdocs}{1}.xml">
>>      <map:select type="parameter">
>>       <map:parameter name="parameter-selector-test" value="{sourcetype}"
>> />
>>       <map:when test="docbook-v4.1.2">
>>         <map:generate src="{project:content.xdocs}{1}.xml" />
>>         <map:transform
>> src="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
>> " />
>>       </map:when>
>>      </map:select>
>>     </map:act>
>>    </map:match>
>>   </map:pipeline>
>>  </map:pipelines>
>> </map:sitemap>
> 
> The following worked for me, although I tested it with v0.8-dev. The
> stylesheet naming convention has changed since v0.7 and I included the
> backwards change in the pasted copy below, but I did not test this with
> v0.7.
> 
> You may also want to use local copies of the DocBook stylesheets as well.
> 
> 
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
> 
>   <map:components>
>     <map:actions>
>       <map:action logger="sitemap.action.sourcetype" name="sourcetype"
> src="org.apache.forrest.sourcetype.SourceTypeAction">
>         <sourcetype name="docbook-v4.1.2">
>           <document-declaration public-id="-//OASIS//DTD DocBook XML
> V4.1.2//EN" />
>         </sourcetype>
>       </map:action>
>     </map:actions>
> 
>     <map:selectors default="parameter">
>         <map:selector logger="sitemap.selector.parameter"
> name="parameter" src="org.apache.cocoon.selection.ParameterSelector" />
>     </map:selectors>
>   </map:components>
> 
>   <map:resources>
>   </map:resources>
> 
>  <map:pipelines>
>   <map:pipeline>
>     <map:match pattern="old_site/*.html">
>      <map:select type="exists">
> 
>       <map:when test="{project:content}{1}.html">
>         <map:read src="{project:content}{1}.html" mime-type="text/html"/>
>         <!--
>           Use this instead if you want JTidy to clean up your HTML
>           <map:generate type="html" src="{project:content}/{0}" />
>           <map:serialize type="html"/>
>         -->
>       </map:when>
>      </map:select>
>    </map:match>
> 
>     <map:match pattern="**.xml">
>       <map:generate src="{project:content.xdocs}{1}.xml" />
> 
>       <map:act type="sourcetype" src="{project:content.xdocs}{1}.xml">
>         <map:select type="parameter">
>           <map:parameter name="parameter-selector-test"
> value="{sourcetype}" />
>         <map:when test="docbook-v4.1.2">
>           <map:transform
> src="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"
> />
>           <map:transform src="{forrest:stylesheets}/html2document.xsl" />
>           <map:transform type="idgen" />
>           <map:serialize type="xml-document" />
>         </map:when>
>       </map:select>
>     </map:act>
>   </map:match>
> 
>   </map:pipeline>
>  </map:pipelines>
> </map:sitemap>
> 
> 

-- 
User Interface Design GmbH
Teinacher Str. 38, 71634 Ludwigsburg
Fon:      +49-7141-37700-0
Fax:      +49-7141-37700-99
Email:    jschaefer@uidesign.de
Internet: www.uidesign.de

Geschäftsstellen:
Teinacher Str. 38,    71634 Ludwigsburg
Truderinger Str. 330, 81825 München
Friedrichsring 46,    68161 Mannheim

Buch "User Interface Tuning" von Joachim Machate & Michael Burmester
www.user-interface-tuning.de

Attraktivität von interaktiven Produkten messen mit
www.attrakdiff.de

Re: Using Docbook

Posted by David Crossley <cr...@apache.org>.
Brian M Dube wrote:
> Johnson, Eric wrote:
> >I'm trying to use docbook files as part of the source to Forrest (v7.0).
> >I want to be able to use docbook and document v2.0. I've tried to get a
> >match and transform working, but to date all I can get is an empty html
> >file as output.
> 
> The following worked for me, although I tested it with v0.8-dev. The 
> stylesheet naming convention has changed since v0.7 and I included the 
> backwards change in the pasted copy below, but I did not test this with 
> v0.7.

Thanks Brian. I had been trying to develop a similar answer
but couldn't get mine to work properly. Your example helped.

I documented that solution at
http://forrest.apache.org/docs/faq.html#docbook

> You may also want to use local copies of the DocBook stylesheets as well.

Definitely. Otherwise it is a very big downlaod.
Cocoon will probably cache the pieces after the
first document is processed. But still.

-David

Re: Using Docbook

Posted by Brian M Dube <br...@gmail.com>.
Johnson, Eric wrote:
> I'm trying to use docbook files as part of the source to Forrest (v7.0).
> I want to be able to use docbook and document v2.0. I've tried to get a
> match and transform working, but to date all I can get is an empty html
> file as output.
> 
> Here is the match from my projects sitemap.xml:
> 
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
> 
>   <map:components>
>     <map:actions>
>       <map:action logger="sitemap.action.sourcetype" name="sourcetype"
> src="org.apache.forrest.sourcetype.SourceTypeAction">
>         <sourcetype name="docbook-v4.1.2">
> 		  <document-declaration public-id="-//OASIS//DTD DocBook
> XML V4.1.2//EN" />
> 		</sourcetype>      
>       </map:action>
>     </map:actions>   
>     
>     <map:selectors default="parameter">
> 	    <map:selector logger="sitemap.selector.parameter"
> name="parameter" src="org.apache.cocoon.selection.ParameterSelector" />
>     </map:selectors>
>   </map:components>
>   
>   <map:resources>    
>   </map:resources>
>   
>  <map:pipelines>
>   <map:pipeline>
>     <map:match pattern="old_site/*.html">
>      <map:select type="exists">
>       <map:when test="{project:content}{1}.html">
>         <map:read src="{project:content}{1}.html"
> mime-type="text/html"/>
>         <!--
>           Use this instead if you want JTidy to clean up your HTML
>           <map:generate type="html" src="{project:content}/{0}" />
>           <map:serialize type="html"/>
>         -->
>       </map:when>
>      </map:select>
>    </map:match>
>   
>    <map:match pattern="**.xml">
>      <map:act type="sourcetype" src="{project:content.xdocs}{1}.xml">
>      <map:select type="parameter">
>       <map:parameter name="parameter-selector-test" value="{sourcetype}"
> />
>       <map:when test="docbook-v4.1.2">
> 	    <map:generate src="{project:content.xdocs}{1}.xml" />
>         <map:transform
> src="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
> " />
>       </map:when>
>      </map:select>
>     </map:act>
>    </map:match>
>   </map:pipeline>
>  </map:pipelines>
> </map:sitemap>

The following worked for me, although I tested it with v0.8-dev. The 
stylesheet naming convention has changed since v0.7 and I included the 
backwards change in the pasted copy below, but I did not test this with 
v0.7.

You may also want to use local copies of the DocBook stylesheets as well.


<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

   <map:components>
     <map:actions>
       <map:action logger="sitemap.action.sourcetype" name="sourcetype" 
src="org.apache.forrest.sourcetype.SourceTypeAction">
         <sourcetype name="docbook-v4.1.2">
           <document-declaration public-id="-//OASIS//DTD DocBook XML 
V4.1.2//EN" />
         </sourcetype>
       </map:action>
     </map:actions>

     <map:selectors default="parameter">
	    <map:selector logger="sitemap.selector.parameter" name="parameter" 
src="org.apache.cocoon.selection.ParameterSelector" />
     </map:selectors>
   </map:components>

   <map:resources>
   </map:resources>

  <map:pipelines>
   <map:pipeline>
     <map:match pattern="old_site/*.html">
      <map:select type="exists">

       <map:when test="{project:content}{1}.html">
         <map:read src="{project:content}{1}.html" mime-type="text/html"/>
         <!--
           Use this instead if you want JTidy to clean up your HTML
           <map:generate type="html" src="{project:content}/{0}" />
           <map:serialize type="html"/>
         -->
       </map:when>
      </map:select>
    </map:match>

     <map:match pattern="**.xml">
       <map:generate src="{project:content.xdocs}{1}.xml" />

       <map:act type="sourcetype" src="{project:content.xdocs}{1}.xml">
         <map:select type="parameter">
           <map:parameter name="parameter-selector-test" 
value="{sourcetype}" />
         <map:when test="docbook-v4.1.2">
           <map:transform 
src="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl" />
           <map:transform src="{forrest:stylesheets}/html2document.xsl" />
           <map:transform type="idgen" />
           <map:serialize type="xml-document" />
         </map:when>
       </map:select>
     </map:act>
   </map:match>

   </map:pipeline>
  </map:pipelines>
</map:sitemap>