old_contents: #!/usr/bin/python
  # -*- coding: latin-1 -*-
  # Copyright 2013 Telefonica Investigacin y Desarrollo, S.A.U
  #
  # This file is part of FI-WARE LiveDemo App
  #
  # FI-WARE LiveDemo App is free software: you can redistribute it and/or modify it under the terms
  # of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the
  # License, or (at your option) any later version.
  #
  # FI-WARE LiveDemo App is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
  # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
  # for more details.
  #
  # You should have received a copy of the GNU Affero General Public License along with FI-WARE LiveDemo App. If not,
  # see http://www.gnu.org/licenses/.
  #
  # For those usages not covered by the GNU Affero General Public License please contact with fermin at tid dot es
  
  __author__ = 'fermin'
  
  import subprocess
  from lxml import etree
  
  p = subprocess.Popen(['./query-van.sh'], shell=False, stdout=subprocess.PIPE)
  output = p.stdout.read()
  
  doc = etree.fromstring(output)
  
  for ce in doc.findall('.//contextElement'):
      id = ce.find('.//id').text
      print id + ':'
      for ca in ce.findall('.//contextAttribute'):
          name = ca.find('name').text
          value = ca.find('contextValue').text
          print '   ', repr(name).ljust(30), ': ', str(value)
  
  
new_contents: #!/usr/bin/python
  # -*- coding: latin-1 -*-
  # Copyright 2013 Telefonica Investigacin y Desarrollo, S.A.U
  #
  # This file is part of FI-WARE LiveDemo App
  #
  # FI-WARE LiveDemo App is free software: you can redistribute it and/or modify it under the terms
  # of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the
  # License, or (at your option) any later version.
  #
  # FI-WARE LiveDemo App is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
  # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
  # for more details.
  #
  # You should have received a copy of the GNU Affero General Public License along with FI-WARE LiveDemo App. If not,
  # see http://www.gnu.org/licenses/.
  #
  # For those usages not covered by the GNU Affero General Public License please contact with fermin at tid dot es
  
  __author__ = 'fermin'
  
  import subprocess
  from lxml import etree
  
  p = subprocess.Popen(['./query-van.sh'], shell=False, stdout=subprocess.PIPE)
  output = p.stdout.read()
  
  doc = etree.fromstring(output)
  
  van_positions = {}
  for ce in doc.findall('.//contextElement'):
      id = ce.find('.//id').text
      for ca in ce.findall('.//contextAttribute'):
          name = ca.find('name').text
          # Actually, vans has only one attribute: current_position
          if name == 'current_position':
             value = ca.find('contextValue').text
             van_positions[id] = value
  
  keys = van_positions.keys()
  keys.sort()
  for van in keys:
      print van + ':'
      print '   ', repr('current_position').ljust(30), ': ', str(van_positions[van])
  
subject: FIX ordered list of vans (closes issue #2)