[Petal] Tree Tactics

Josh Narins josh at narins.net
Fri Sep 2 12:47:38 BST 2005


> On Thu 01-Sep-2005 at 16:19 +0100, Chris Croome wrote:
> > 
> > With MKDoc, for things like the sitemap, which is made up of nested
> > <UL>s, we use an include file -- it's not a single template, I don't
> > know how you would do it with a single template, but it might well
> > be possible...
> 
> The sitemap fragment that includes itself looks something like this:
> 
>   <?xml version="1.0"?>
>   <li xmlns:petal="http://purl.org/petal/1.0/">
>     <a
>       href="#"
>       petal:attributes="href child/URI"
>       petal:content="child/Title"
>     >Child Document Title</a>
>     <ul
>       petal:define="children child/Children"
>       petal:condition="children"
>       petal:repeat="child children"
>     >
>     <?include file="fragment.xml"?>
>     </ul>
>   </li>
> 
> Note that 'Children' is a method that returns a list of objects that
> are already sorted.  We don't try to do the sorting in the template.

Sorry for the confusion.

My own efforts would have worked had their not been bad data
in the database, which was resulting in a bad select, which 
made the tree "wrong" when displayed.

Recursively called templates work fine.




More information about the Petal mailing list