@validate('form')
def valid_page_in_book(arch):
 return (not arch.xpath('//page[not(ancestor::notebook)]'))

@ validate ( 'form' ) def valid_page_in_book ( arch ) : return ( not arch . xpath ( '//page[not(ancestor::notebook)]' ) )
a page node must be below a notebook node .