#! /usr/bin/env python
import sys, libxml2
def open(xml_file):
  doc = libxml2.parseFile (xml_file)
  ctxt = doc.xpathNewContext()
  # 1
  book = ctxt.xpathEval("//book[@price>30 and @price<40]")
  print "1"
  i=0;
  for element in book: 
   print book[i].content
   i=i+1 

  ctxt.xpathFreeContext ()
  doc.freeDoc ()



def main(argv):
  if len(argv) != 2:
    sys.stderr.write("Usage : %s xml_file" % (argv[0],))
  else:    open(argv[1])
if __name__ == '__main__': main(sys.argv)
