# File lib/PageTemplate/commands.rb, line 439
    def output(namespace)

      vals = namespace.get(@value)
      ns = nil
      return @elseCommands.output(namespace) unless vals
      unless vals.respond_to?(:map) && vals.respond_to?(:length)
        vals = [vals]
      end

      return @elseCommands.output(namespace) if vals.empty?

      # Unfortunately, no "map_with_index"
      len = vals.length
      i = 1
      odd = true
      ns = Namespace.new(namespace)

      # Print the output of all the objects joined together.
      case
      when @iterators.nil? || @iterators.empty?
        vals.map { |item|
          ns.clear
          ns.object = item
          ns['__FIRST__'] = (i == 1) ? true : false
          ns['__LAST__'] = (i == len) ? true : false
          ns['__ODD__'] = odd
          ns['__INDEX__'] = i-1
          odd = ! odd
          i += 1
          @commands.output(ns)
        }.join('')
      when @iterators.size == 1
        iterator = @iterators[0]
        vals.map { |item|
          ns.clear_cache
          # We have an explicit iterator - don't set an object for it.
          # ns.object = item
          ns['__FIRST__'] = (i == 1) ? true : false
          ns['__LAST__'] = (i == len) ? true : false
          ns['__ODD__'] = odd
          ns['__INDEX__'] = i-1
          odd = ! odd
          ns[iterator] = item
          i += 1
          @commands.output(ns)
        }.join('')
      else
        vals.map { |list|
          ns.clear_cache
          ns['__FIRST__'] = (i == 1) ? true : false
          ns['__LAST__'] = (i == len) ? true : false
          ns['__ODD__'] = odd
          ns['__INDEX__'] = i-1
          @iterators.each_with_index do |iterator,index|
            ns[iterator] = list[index]
          end
          odd = ! odd
          i += 1
          @commands.output(ns)
        }.join('')
      end
    end