forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sina K. Heshmati" <s...@khakbaz.com>
Subject Re: xdocs title element and the title bar of browser windows
Date Sat, 14 Nov 2009 18:07:10 GMT
"Vicent Mas" <uvemas@gmail.com> said:

> On 2009-11-14 Tim Williams <williamstw@gmail.com> said:
>> On Sat, Nov 14, 2009 at 7:38 AM, Vicent Mas <uvemas@gmail.com> wrote:
>> > On 2009-11-13 Vicent Mas <uvemas@gmail.com> said:
>> >> Hi all,

<snipped/>

>> >> I'd like to know how to specify different titles for the HTML head and
>> >> the HTML body. Is ther a direct way for doing it with Forrest? Or have I
>> >> to do some hacking?

>> > I've been playing around with contracts that seem related to the subject
>> > (namely content-title.ft and title.ft) but I cannot figure out how to do
>> > what I want in an easy way.
>> >
>> I haven't poked around with dispatcher in a long time and don't
>> remember the preferred way of modifying contracts, but it looks like
>> your on the right track with the content-title contract.  That
>> contract appears to output a title in two locations (the two
>> forrest:part elements), you're happy with one, but not the other.
>>
>> It's been a while, so this may not be correct, but you might try...

Tim's solution can perfectly cover your requirement.

>> o) Overriding the content-title contract in your local project,
>> removing the undesired output part.
> 
> Overriding this contract is what I'm trying to do. As I said I want 2 different
> titles, head-title and body-title. Right now what I'm doing for specifying
> both titles in my xdoc sources is something like
> 
> <head>
>   <title id="body-title">head-title</title>
> </head>
> 
> This is something dirty I know, but it is my only idea right now.
> 
> 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


Mime
View raw message