forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vicent Mas <uve...@gmail.com>
Subject Re: xdocs title element and the title bar of browser windows
Date Mon, 16 Nov 2009 08:23:22 GMT
On 2009-11-14 "Sina K. Heshmati" <sina@khakbaz.com> said:

> 
> <snipped/>
> 
> >
> > My main problem is that I don't understand how content-title.ft works:
> >
> >           <forrest:part xpath="/html/head">
> >             <xsl:comment>+ |start content-title +</xsl:comment>
> >             <xsl:copy-of select="$content-title/*"/>
> >             <xsl:comment>+ |end content-title +</xsl:comment>
> >           </forrest:part>
> >
> > How does the contract get the value "$content-title/*"? If I replace this
> > value for a string literal then the title element is not included in the
> > head of the generated HTML file but in the body. Why?
> 
> In this case, $content-title is bound to 'http://.../yourxdoc.title.xml'
>  for it's called this way:
> 
> <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>
> 
> >> o) Finding the right contract to override to output the title in a new
> >> location (override that contract, find the right params to pass in,
> >> etc.)
> >
> > I don't understand what you mean. As I said what I want is 2 different
> > titles. I'm happy with the current locations where titles appear in the
> > generated HTML files.
> 
> What I think Tim meant was is to make head/title available using a new
>  dataURI, say *.head.title.xml and call the content-title contract or the
>  one you'll have made for head/title using the new dataURI.
> 
> Sina
> 

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>
...

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>
            <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 />
      </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


Mime
View raw message