Re: Tree Tactics

Bruno Postle <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.petal
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.