# -*- ruby -*- # # Using . See also sample10.rb. # require 'xtemplate' class Link attr_reader :url, :name def initialize(url, name) @url = url @name = name end end data ={ 'links' => [ Link.new("url1", "anchor1"), Link.new("url2", "anchor2"), Link.new("url3", "anchor3"), ] } text = < EOF t = XTemplate::XMLTemplate.new(text) print(t.expand(data))