[MKDoc-dev] [1.6 bug] Using self/parent/parent for detecting where one is in the document hierarchy

Chris Croome chris at webarchitects.co.uk
Tue Feb 28 13:03:20 GMT 2006


Hi

On Fri 24-Feb-2006 at 12:48:23PM +0000, Bruno Postle wrote:
> 
> Test for the existence of self/parent first:
> 
>  <h1 petal:condition="self/parent">
>    This document has a parent called
>    <span petal:replace="self/parent/title">Mavis</span>
>  </h1>
> 
>  <h1 petal:condition="self/parent; self/parent/parent">
>    This document has a grandparent called
>    <span petal:replace="self/parent/parent/title">Betty</span>
>  </h1>
> 
>  <h1 petal:condition="false: self/parent">
>    This document doesn't have a parent :-(
>  </h1>
> 
>  <h1 petal:condition="self/parent; false: self/parent/parent">
>    This document doesn't have a grandparent :-(
>  </h1>

I know this should work but it doesn't seem to -- for example try this
code in a document:

  <!--? document location test code -->
    <!--? root document -->
      <div
        petal:condition="false: self/parent;" 
      >
        This document has no parent therefore it must be the front page.
      </div>
    <!--? child document -->
      <div
        petal:condition="true:  self/parent; 
                         false: self/parent/parent;"
      >
        This document has a parent but no grand parent, therfore
        it must be a child of the front page document.
      </div>
    <!--? grandchild document -->
      <div
        petal:condition="true:  self/parent/parent;
                         false: self/parent/parent/parent;"
      >
        This document has a parent and a grand parent, therfore
        it must be a grandchild of the front page document.
      </div>
    <!--? great grandchild document -->
      <div
        petal:condition="true:  self/parent/parent/parent;
                         false: self/parent/parent/parent/parent;"
      >
        This document has a parent and a grand parent and a great
        grandparent, therefore it must be a great grandchild of
        the front page document.
      </div>
    <!--? great great grandchild document -->
      <div
        petal:condition="true:  self/parent/parent/parent/parent;
                         false: self/parent/parent/parent/parent/parent;"
      >
        This document has a parent and a grand parent and a great
        grandparent and a great great grandperent, therefore it must
        be a great great grandchild of the front page document.
      </div>

I get a internal server error and this error in the logs when this is
added to a template that is a child of the front page:

  [PETAL ERROR] Cannot find value for 'parent' at '/self/parent/parent': parent cannot be retrieved

Chris

-- 
Chris Croome                               <chris at webarchitects.co.uk>
web design                             http://www.webarchitects.co.uk/ 
web content management                               http://mkdoc.com/   


More information about the MKDoc-dev mailing list