forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thorsten.scherler....@juntadeandalucia.es>
Subject Re: xdocs title element and the title bar of browser windows
Date Mon, 16 Nov 2009 10:22:10 GMT
On Mon, 2009-11-16 at 09:23 +0100, Vicent Mas wrote:
> On 2009-11-14 "Sina K. Heshmati" <sina@khakbaz.com> said:
> 
...
> > <forrest:contract name="content-title"
> >    dataURI="cocoon://#{$getRequest}.title.xml"/>
> > 
> > Please note that, the content of *.title.xml is in this form: <title>A
> >  Title</title>
> > ...
> > 
> 
> OK. Now I understand the problem better... but I still cannot fix it. I've done 
> the following:
> 
> 1) I wasn't very happy with the dirty trick of using an id attribute for 
> passing the second title. So I've extended the document-v2.dtd with a new 
> btitle element. I use this element to pass the body title:
> 
> <document>
> 	<head><title>Head title</title></head>
> 	<body><btitle>Body title</btitle>
> ...

I am not sure whether you really want to do that since you need to
maintain the resulting dtd.

> 
> 2) I've overriden the content-title.ft contract. I've commented out the lines:
>           <!--<forrest:part>
>             <xsl:comment>+ |start content-title +</xsl:comment>
>             <h1 class="content-title">
>               <xsl:value-of select="$content-title/*"/>
>             </h1>

Sian explained that $content-title is from <xsl:param
name="content-title" select="/"/>

Meaning you can pass the content from the structurer and if not it will
use the doc root. 

Another way would be to pass it via a property:

<forrest:contract name="content-title">
  <forrest:property name="content-title">
    <title>my title</title>
  </forrest:property>
</forrest:contract>

You can as well create a complete different pipeline which will return
you the different values dynamically. 

<forrest:contract name="content-title"
dataURI="cocoon://#{$getRequest}.myTitle.xml"/>

Where you then implement a pipeline <match pattern="*.myTitle.xml"/>
which should return <title>myTitle</title>.


>             <xsl:comment>+ |end content-title +</xsl:comment>
>           </forrest:part>-->
> 
> 3) By imitating content-title.ft I've created a new contract, body-title.ft. 
> It should create the body title. I've attached it to this mail.
> 
> 4) Imitating the dispatcher dataModel.xmap (in particular the title.xml 
> pipeline) I've modified my local sitemap and added the following lines:
> 
>     <map:pipeline>
>       <map:match pattern="**.btitle.xml">
>         <map:generate src="cocoon://{1}.xml" />
>         <map:transform src="{lm:dataModel-xml-document-to-btitle.xsl}" />
>         <map:serialize />


Make sure that the above serializer returns xml. Seeing your error below
I think that the default is xhtml. Try <map:serialize type="xml"/>

That should work.

salu2

>       </map:match>
>     </map:pipeline>
> 
> 5) in my local stylesheets directory I've created the file xslt/xml/document-
> to-btitle.xsl. It extracts the content of the btitle element.
> 
> Now I run forrest and get the following error:
> 
> Message: null
> Description: No details available.
> Sender: org.apache.cocoon.servlet.CocoonServlet
> Source: Cocoon Servlet
> cause
> 
> dispatcherError: 500 - Internal server error
> The contract "body-title" has thrown thrown an exception by resolving raw data 
> from "cocoon://index.btitle.xml".
> 
> dispatcherErrorStack:
>  java.io.IOException: Server returned HTTP response code: 503 for URL: 
> http://www.w3.org/TR/html4/loose.dtd
> 
> Request URI
> index.html
> request-uri
> /index.html;jsessionid=3tf3ujcnmsumk
> 
> Could you give me a hand (again) please? I'm reading sitemap documentation, 
> but it is not easy for a newbie. And Google didn't help me.
> 
> Thanks
> 
> Vicent
> 
> PS: sorry for the lengthy mail.
> ::
> 
> 	Share what you know, learn what you don't
> 
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la InformaciĆ³n, S.A.U. (SADESI)





Mime
View raw message