[Petal] Tree Tactics

Bruno Postle bruno at mkdoc.com
Thu Sep 1 17:24:31 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.

-- 
Bruno


More information about the Petal mailing list