You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by HANAX <ha...@centrum.sk> on 2005/07/09 14:57:56 UTC

TOC in output plugin

I was told that durin processing there is a TOC build. How I can acces it in my XSL file? Or another way: how can I access list of sections and transform it into list of elements in head of XHTML while processing my xsl file?
I've started with text plugin as example but it's little bit complicated for me, can anybody recommend me simpler example?
And last, if I want to use XHTML serializer, it gives me an error "Type 'xhtml' does not exist for 'map:serialize'". Why?

Re: TOC in output plugin

Posted by Ross Gardler <rg...@apache.org>.
Thorsten Scherler wrote:
> On Sat, 2005-07-09 at 14:57 +0200, HANAX wrote:
> 
>>I was told that durin processing there is a TOC build. How I can acces it in my XSL file?
> 
> 
> this ToC is created for e.g. in document2html.xls from the skin you are
> using.


I do not recommend that you work with the TOC generated by the skin in 
use, this is designed for visual display in a browser. I am assuming you 
are working on the voiceXML plugin, if that is the case you are creating 
a new output format. Do not work with the XHTML created by the skin, you 
will be adding an additional layer of complexity to your own work.

For example, the TOC creation is dependant on a setting in the 
skinconf.xml file. For your use case I guess you will always want a TOC 
(otherwise how does the user now what is available in the file to 
navigate it).

> In views the content-minitoc.ft is using it after the processing of
> document2html.xls:

Using the existing skin (or views) XSL snippets will help you understand 
th XSL needed to extract things like TOC information

>> Or another way: how can I access list of sections and transform it into list of elements in head of XHTML while processing my xsl file?

Again, do not work with XHTML. You would be better working directly with 
the XDoc source.

(this does not change what Thorsten has said about Views, as he 
explained a view is nothing more than a final rendering of the output 
format.


Ross

Re: TOC in output plugin

Posted by Thorsten Scherler <th...@apache.org>.
On Sat, 2005-07-09 at 14:57 +0200, HANAX wrote:
> I was told that durin processing there is a TOC build. How I can acces it in my XSL file?

this ToC is created for e.g. in document2html.xls from the skin you are
using.

In views the content-minitoc.ft is using it after the processing of
document2html.xls:
http://svn.apache.org/viewcvs.cgi/*checkout*/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/content-minitoc.ft
<xsl:template name="content-minitoc-body"
match="div[@id='content']/div[@id='skinconf-toc-page']">
	<xsl:comment>+
	    |start content-minitoc
	    +</xsl:comment>
		
		    <xsl:if test="$config/toc">
		      <xsl:if test="contains($minitoc-location,'page')">
		        <xsl:if test="count(//tocitems/tocitem) >= $config/toc/@min-sections">
					<div id="content-minitoc-area">
		    			<xsl:call-template name="minitoc">
		        		    <xsl:with-param name="tocroot" select="//tocitems"/>
			          	</xsl:call-template>
					</div>
			    </xsl:if>
		      </xsl:if>
		    </xsl:if>
 
<xsl:comment>+
    |end minitoc
    +</xsl:comment>
		  </xsl:template>

I intercept the last processing pipeline (site2xhmtl.xsl) with views and
like state before using document2html.xsl from the skin.
http://svn.apache.org/viewcvs.cgi/*checkout*/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap
 <map:match pattern="*.page">
	<map:aggregate element="site">
          <map:part src="cocoon://skinconf.xml"/>
          <map:part src="cocoon://build-info"/>
          <map:part src="cocoon://tab-{1}.html"/>
          <map:part src="cocoon://menu-{1}.html"/>
          <map:part src="cocoon://body-{1}.html"/>
          <map:part src="cocoon:/prepare.view-nugget.{1}"/>
        </map:aggregate>
        <map:serialize type="xml"/>
    </map:match>

>  Or another way: how can I access list of sections and transform it into list of elements in head of XHTML while processing my xsl file?

Can you tell a little bit more what you are planing to do? It sounds to
me that you could use views for what you are planing to do.

Let me explain why. I remember you doing the sound output via forrest,
right? 

I reckon you would not only output the document content but as well
navigation, or?

If so you would create a plugin of the same nature of
org.apache.forrest.plugin.output.viewHelper.xhtml or general speaking a
view plugin.

A view plugin allows to output content to different presentation medias.
I am very keen to assist if you need more infos on how to do it.


> I've started with text plugin as example but it's little bit complicated for me, can anybody recommend me simpler example?
> And last, if I want to use XHTML serializer, it gives me an error "Type 'xhtml' does not exist for 'map:serialize'". Why?

http://svn.apache.org/viewcvs.cgi/*checkout*/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap
<map:serializer logger="sitemap.serializer.xhtml" mime-type="text/html"
name="xhtml" pool-grow="2" pool-max="64" pool-min="2"
src="org.apache.cocoon.serialization.XMLSerializer">
	      <!--+
	          | You can choose from Strict, Transitional, or Frameset XHTML.
	          | For Strict XHTML set doctype to:
	          |   <doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public>
	          |   <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system>
	          | For Transitional XHTML set doctype to:
	          |   <doctype-public>-//W3C//DTD XHTML 1.0 Transitional//EN</doctype-public>
	          |   <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</doctype-system>
	          | For Frameset XHTML set doctype to:
	          |   <doctype-public>-//W3C//DTD XHTML 1.0 Frameset//EN</doctype-public>
	          |   <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd</doctype-system>
	          |
	          | Default XHTML doctype in Cocoon is XHTML Strict. If you want to use more than one
	          | XHTML DTD simultaneously, you can define several XHTML serializers.
	          +-->
	      <doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public>
	      <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system>
	      <encoding>UTF-8</encoding>
	    </map:serializer>

HTH

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)