forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Gardler <rgard...@apache.org>
Subject Re: hooks injection (was Re: DispatcherTransformer.java )
Date Tue, 22 Nov 2005 12:51:03 GMT
Thorsten Scherler wrote:
> El lun, 21-11-2005 a las 12:04 +0000, Ross Gardler escribió: 
> ...
> 
>>>>>>The question is how can we make contracts more generic. One way is
to
>>>>>>get rid of head|body="true|false". I thought that each contract has
to
>>>>>>provide this information from the resulting transformation.
>>
>>...
>>
>>
>>>>How about:
>>>>
>>>><content xpath="/html/body">
>>>>  <!-- the HTML generated by the contract -->
>>>></content>
>>>>
>>...
>>
>>
>>>Assuming forrest:hook will be transformed to div id="test" the location
>>>would be
>>>xpath="html/body/div[@id='test']"
>>>
>>>I call this <content xpath="html/body"/> xpath structure aware, because
>>>it is more a xpath prefix then a fixed location.
>>>
>>>Now think you would add 
>>><content xpath="html/head">
>>> <something/>
>>></content>
>>>
>>>That should not be aware of the structure. It should be insert in the
>>>fixed location "html/head" otherwise you would get invalid markup.
>>>
>>>To solve this problem I would like to propose to add an attribute
>>>fixedLocation="true|false". So this makes 
>>><content xpath="html/head" fixedLocation="true">
>>> <something/>
>>></content>
>>>
>>>I propose to make the default fixedLocation="false". That means the
>>>content will be injected in the overall structure defined by the
>>>structurer (*.fv), the content is structure aware.
>>
> 
> A similar problem is with hooks. Till now we assumed that all hooks go
> into /html/body but this need to be more flexible. I propose to add a
> new attribute @hooksXpath to the forrest:view.

I'm not sure I can see a use case for this, I'll respond assuming you 
have one, but an example may help.

> 
> <forrest:view type="html" hooksXpath="/html/body">
>  <forrest:hook name="htmlBodyHook"/>
> </forrest:view>
> 
> that will be transformed into 
> <html>
>  <body>
>   <forrest:hook name="htmlBodyHook"/>
>  </body>
> </html>
> 
> I propose this attribute @hooksXpath as required.

This makes the assumption that all hooks are to be placed in the same 
location within the output file. Can we safely make that assumption? Can 
we imagine a situation where we have a single view defining hooks that 
go into a different place?

If not then you proposal is good.

Ross




Mime
View raw message