You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Cyriaque Dupoirieux <Cy...@pcotech.fr> on 2005/07/25 13:06:50 UTC

[Views]Enable to call twice the same contract with different properties...

Hi,

    It seems to be impossible to call twice the same contact with 
different properties (arguments).
    I tried to call twice a search-input contract of my own - which 
accepts input field size argument - with two different size. Only the 
first size is taken into account.

   
------------------------------------------------------------------------
       <forrest:contract name="search-input">
          <forrest:properties contract="search-input">
            <forrest:property name="input-size">*25*</forrest:property>
          </forrest:properties>
        </forrest:contract>
       . . .
      <forrest:hook name="menu">
        <forrest:contract name="pelt-nav-section"/>
        <forrest:contract name="search-input">
          <forrest:properties contract="search-input">
            <forrest:property name="input-size">*18*</forrest:property>
          </forrest:properties>
        </forrest:contract>
       
------------------------------------------------------------------------
The size of the search form Input field is 25 in both cases.

-- 

Cordialement,
Cyriaque,


Re: [Views]Enable to call twice the same contract with different properties...

Posted by Thorsten Scherler <th...@apache.org>.
On Mon, 2005-07-25 at 13:13 +0200, Thorsten Scherler wrote:
> On Mon, 2005-07-25 at 13:06 +0200, Cyriaque Dupoirieux wrote:
> > Hi,
> > 
> >     It seems to be impossible to call twice the same contact with 
> > different properties (arguments).
> >     I tried to call twice a search-input contract of my own - which 
> > accepts input field size argument - with two different size. Only the 
> > first size is taken into account.
> > 
> 
> Yes that is right. I am still thinking how to overcome this problem that
> is based on the architecture. 

To explain that:
We are creating a "dynamic build" stylesheet (former site2xhtml.xsl). We
are doing this with the 
<map:match pattern="getStylesheet.*.**">
in the internal.xmap of views.

The "resources/stylesheets/prepare.xhtml.xsl" is creating alias elements
that will be switched to the xsl namespace by 
<xsl:namespace-alias result-prefix="xsl" stylesheet-prefix="alias"/>

Now what I did before was matching a node of the *.page aggregation. I
just fixed it to the current location.
- <alias:with-param name="{@name}"
select=".//forrest:properties[@contract='{$name}']/forrest:property[@name='{@name}']"/>
+ <alias:with-param name="{@name}" select="'{.}'"/>

Can you try this. I hope it will solve the use case.


BTW
There is another problem I have to fix ASAP which is related. 

One can not only use *-body and *-head templates in a contract e.g.
content-ls-contracts.ft. That causes that there are multiple templates
with the same name because everything within <xsl:stylesheet/> will be
copied.

We have to make sure that each and all contract xsl:templates just get
included once in the stylesheet aggregation even if the contract get
called twice. 

Besides we need to specify better how to write a contract. The mentioned
content-ls-contracts.ft should use
<xsl:template match="document" mode="content-ls-contracts/> instead of
<xsl:template match="document">. That makes it unique what every
contract has to/better be all times.

salu2
thorsten

> If you have an idea please let me know. I
> will have a look on that ASAP. ATM I am busy to work off the holiday
> stack. ;-)
> 
> salu2
> 
> >    
> > ------------------------------------------------------------------------
> >        <forrest:contract name="search-input">
> >           <forrest:properties contract="search-input">
> >             <forrest:property name="input-size">*25*</forrest:property>
> >           </forrest:properties>
> >         </forrest:contract>
> >        . . .
> >       <forrest:hook name="menu">
> >         <forrest:contract name="pelt-nav-section"/>
> >         <forrest:contract name="search-input">
> >           <forrest:properties contract="search-input">
> >             <forrest:property name="input-size">*18*</forrest:property>
> >           </forrest:properties>
> >         </forrest:contract>
> >        
> > ------------------------------------------------------------------------
> > The size of the search form Input field is 25 in both cases.
> > 
-- 
thorsten

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


Re: [Views]Enable to call twice the same contract with different properties...

Posted by Thorsten Scherler <th...@apache.org>.
On Mon, 2005-07-25 at 13:06 +0200, Cyriaque Dupoirieux wrote:
> Hi,
> 
>     It seems to be impossible to call twice the same contact with 
> different properties (arguments).
>     I tried to call twice a search-input contract of my own - which 
> accepts input field size argument - with two different size. Only the 
> first size is taken into account.
> 

Yes that is right. I am still thinking how to overcome this problem that
is based on the architecture. If you have an idea please let me know. I
will have a look on that ASAP. ATM I am busy to work off the holiday
stack. ;-)

salu2

>    
> ------------------------------------------------------------------------
>        <forrest:contract name="search-input">
>           <forrest:properties contract="search-input">
>             <forrest:property name="input-size">*25*</forrest:property>
>           </forrest:properties>
>         </forrest:contract>
>        . . .
>       <forrest:hook name="menu">
>         <forrest:contract name="pelt-nav-section"/>
>         <forrest:contract name="search-input">
>           <forrest:properties contract="search-input">
>             <forrest:property name="input-size">*18*</forrest:property>
>           </forrest:properties>
>         </forrest:contract>
>        
> ------------------------------------------------------------------------
> The size of the search form Input field is 25 in both cases.
> 
-- 
thorsten

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