cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <nicola...@apache.org>
Subject Re: linking from main samples to block samples
Date Thu, 08 May 2003 09:31:49 GMT


Bertrand Delacretaz wrote, On 08/05/2003 10.51:
...
> Ok - detecting the presence of blocks or components dynamically is 
> certainly possible, but AFAIK there's no easy mechanism for relaying 
> this info to an XSLT page that would include links or not. I'd be glad 
> to be proven wrong though ;-)

If block.properties was blockprops.xml, both Ant and Cocoon could read 
it... ;-)

Ok, ok, here is how it can be done now:

  1 - use xslt to transform module.xml to a temp.xml file that shows
      all blocks, and that adds a ${exclude.xxx.block} element:

      <blocks>
        <block name="xxx" exclude="${exclude.xxx.block}">
          <description><description>
        <block>
        ...
      </blocks>

  2 - then load block.properties and filter the file to
      expand the propertirs with:

   <copy srcFile="temp.xml">
     ...
     <filterchain>
       <expandproperties/>
     </filterchain>
   </loadfile>

  3 - Now we have:

      <blocks>
        <block name="xxx" exclude="true">
          <description><description>
        <block>
        <block name="yyy" exclude="false">
          <description><description>
        <block>
        ...
      </blocks>

    We can now style this with xslt in Ant or Cocoon to not show
    items where @exclude="true"

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


Mime
View raw message