Ross Gardler a écrit :

Thorsten Scherler wrote:

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/[EMAIL PROTECTED]'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.


Of course, obvious really!

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



wdyt?


+1

I like it too,

Can you remind me what :
   <forrest:view type="html" hooksXpath="/html/head">
       <forrest:hook name="htmlHeadHook"/>
   </forrest:view>

will generate ?

Salutations,
Cyriaque,


Ross