forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thors...@apache.org>
Subject hooks injection (was Re: DispatcherTransformer.java )
Date Tue, 22 Nov 2005 11:03:08 GMT
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.

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

***
I as well thought about another attribute @xpath for the forrest:hooks,
but that does not convinced me much:
<forrest:view type="html" hooksDefaultXpath="/html/body">
 <forrest:hook name="htmlBodyHookHook"
xpath="/html/body/forrest:hook[@name='htmlBodyHook']"/>
</forrest:view>

what is the same as:
<forrest:view type="html" hooksDefaultXpath="/html/body">
 <forrest:hook name="htmlBodyHook">
  <forrest:hook name="htmlBodyHookHook"/>
 </forrest:hook>
</forrest:view>

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

True with this attribute one would be super flexible but still I am
afraid that the structurer then will become pretty fast very complex and
against its logic because of something like:
<forrest:view type="html" hooksDefaultXpath="/">
 <forrest:hook name="htmlBodyHook" xpath="/html/body">
  <forrest:hook name="htmlBodyAnotherHook" xpath="/html/body"/>
 </forrest:hook>
</forrest:view>

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

That just does not feels right because in the structurer
htmlBodyAnotherHook is child of htmlBodyHook but in the resulting
transformation not anymore.

WDYT?

salu2
-- 
thorsten

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


Mime
View raw message