forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thors...@apache.org>
Subject Re: hooks injection (was Re: DispatcherTransformer.java )
Date Tue, 22 Nov 2005 13:17:31 GMT
El mar, 22-11-2005 a las 12:51 +0000, Ross Gardler escribió:
> 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.
> 

Actually it is html vs. any format. Html makes it necessary that hooks
are placed into a certain location. Otherwise you would get the hooks
transformed into the root.

e.g. for a view type="xml" @hooksXpath="/"

<forrest:hook name="test">
 <forrest:hook name="test2"/>
</forrest:hook>

may be (depends on the hooks-to-xml.xsl) transformed to 
<test>
 <test2/>
</test>

like said above in html that would not make sense since everything has
to go to /html/head or /html/body.


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

That would be possible by defining hooksXpath="/" and then generating
the path with hooks. 

Maybe we need another attribute in hooks @element which would not create
a div but the value of @element:
<forrest:hook element="html">
 <forrest:hook element="body">
  <forrest:hook name="htmlBodyHook"/>
 </forrest:hook>
</forrest:hook>

 that will be transformed into 
>  <html>
>   <body>
>    <forrest:hook name="htmlBodyHook"/>
>   </body>
>  </html>

> 
> If not then you proposal is good.

wdyt?
-- 
thorsten

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


Mime
View raw message