forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thors...@apache.org>
Subject Re: [RT] future of v2
Date Wed, 16 Nov 2005 11:39:35 GMT
El jue, 10-11-2005 a las 16:36 +0100, Thorsten Scherler escribió:
> Hi all,
> 
> I am working on some java classes that should become the dispatcher
> core. While doing it I thought about the usage of contracts. We are now
> doing a parallel processing which has influence on the performance. 
> 
> Introducing jx:import reduced a wee bit the build time and the recent
> update of the lm a lot more. Still it is too slow. Doing some process
> consulting on v2 we pointed out that the xsl magic is slowing as well
> things down. The idea has to be to slim down the processing. 
> 
> IMO contracts have to work standalone. Meaning that the dispatcher will
> call the contract with the given properties and include the *result* and
> not raw-data and xsl. 

I have a basic contract.java doing the above written. It is a bean
containing besides other:
private Document contractImpl;
private Document contractRawData;
private Element contractTransformer;

I need to write a cocoon-transfomer that is doing the following when
encounter a contract:
a) create new contract bean with a contract structurer element coming
from e.g. index.fv
b) load contract bean with 
 I. the contract implementation (e.g. nav-main.ft)
 II. the raw data if it is a nugget contract
 III. the transfomer (e.g. the xsl:stylesheet from the nav-main.ft)
c) transform the contract data (raw data, if nugget and/or properties)
with the transfomer (III.)
d) add transformed contract to the contentHandler. 

My current testing code ignores ATM forrest:properties because I thought
about them a wee bit and since contracts are now standalone we could:
a) keep it like it is - passing the properties as xsl:param to the
stylesheet like 
transformer.setParameter("someProperty", somePropertyElement);)

b) include them into the raw data document like:
<data>
 <raw>{nugget}</raw>
 <properties>{f:p}</properties>
</data>

In both ways contracts should change. Here my current testing version:
<forrest:contract name="nav-main-testing" type="nugget"
  xmlns:forrest="http://apache.org/forrest/templates/1.0">
  <description>
    nav-main will output the main or primary navigation AKA tabs.
  </description>
  <usage><![CDATA[<forrest:contract name="nav-main-testing"
nugget="cocoon://#{$cocoon/parameters/getRequest}.navigation.xml"/>]]>
    </usage>
  <forrest:template
  xmlns:forrest="http://apache.org/forrest/templates/1.0"
  format="html" name="nav-main-testing" inputFormat="xsl" >

    <xsl:stylesheet version="1.1" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--Should we prefer b)? -->
      <xsl:param name="nav-main-testing" select="/"/>
<!-- We are now matching root because contracts are standalone -->
      <xsl:template match="/" >
        <html>
          <head/>
          <body>
            <div id="tabs">
              <xsl:comment>+ |start Tabs new +</xsl:comment>
              <xsl:copy-of 

select="$nav-main-testing/navigation/tab/ul[@id='nav-main']"/>
              <xsl:comment>+ |end Tabs +</xsl:comment>
            </div>
          </body>
        </html>
      </xsl:template>
    </xsl:stylesheet>
	</forrest:template>
</forrest:contract>

I have shorten the definition of nugget-contracts in the structurer:
<forrest:contract name="nav-main-testing"
nugget="cocoon://#{$cocoon/parameters/getRequest}.navigation.xml"/>

> 
> Now my idea is that a structurer will
> a) resolved via lm
> b) transformed with jx
> c) dispatch and include transformed contracts

I still need to write the transfomer, right now I am testing with a
generator but that should/will become a transfomer.

> d) transform hooks into format specific markup
> e) transform all above to the final page
> 
> 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.

Above contract solved the issue.

> 
> Then the last transformation e) would only have to clean the html/* stuff.

This I will implement as soon the transfomer is ready.

WDYT?

salu2
-- 
thorsten

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


Mime
View raw message