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

Bruno Postle bruno at mkdoc.com
Fri Feb 24 12:48:23 GMT 2006


>  [PETAL ERROR] Cannot find value for 'equals' at 
>  '/self/parent/parent': equals cannot be retrieved (current value 
>  was undef, near self/parent/parent/equals ancestor) at 
>  /usr/lib/perl5/site_perl/5.8.6/Petal/Hash/Var.pm line 125

If self/parent doesn't return a document, then calling a method on 
this non-object can't possibly work.

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>

-- 
Bruno


More information about the MKDoc-dev mailing list