Using XTemplate::XMLDocument
XTemplate::XMLDocument
XTemplate::XMLDocument is a class for a XML document which is used as an expansion data. Here is an example.
require 'xtemplate'
data = XTemplate::XMLDocument.new(<<EOS)
<?xml version="1.0"?>
<members>
  <member><name>name1</name><age>27</age></member>
  <member><name>name2</name><age>26</age></member>
</members>
EOS
tpl = XTemplate::XMLTemplate.new(<<EOS)
<html><body>
  <ul>
    <li id="/members/member/name" />
  </ul>
</body></html>
EOS
puts(tpl.expand(data))
      
The result of the above is as follows:
<html><body>
  <ul>
    <li>name1</li><li>name2</li>
  </ul>
</body></html>