title: How do I render an array of Java beans to XML with struts2?
body: <p>My output should be something like this:</p>
  
  <pre><code>&lt;result&gt;
    &lt;item&gt;
      &lt;id&gt;123&lt;/id&gt;
      &lt;src&gt;123&lt;/src&gt;
      &lt;dst&gt;123&lt;/dst&gt;
    &lt;/item&gt;
    &lt;item&gt;
    &lt;!-- ... --&gt;
    &lt;/item&gt;
  &lt;/result&gt;
  </code></pre>
  
  <p>And the action class would have a method <code>getFoos</code> which returns an array of uniform objects, e. g. like this:</p>
  
  <pre><code>class Foo {
    // ...
    public long getId() { ... }
    // ...
  }
  </code></pre>
  
  <p>I'm using the XSLTResult like this:</p>
  
  <pre><code>&lt;action name="channels" method="loadAll" class="com.econemon.suite.api.impl.FooAction"&gt;
    &lt;result name="success" type="xslt"&gt;
      &lt;param name="exposedValue"&gt;foos&lt;/param&gt;
    &lt;/result&gt;
  &lt;/action&gt;
  </code></pre>
  
  <p>Since I don't want to postprocess the XML, I didn't specify any template, after reading several tutorials that said this would work. Instead, it gives me this error:</p>
  
  <blockquote>
    <p>javax.xml.transform.TransformerException: Operation not supported. - [unknown location]</p>
  </blockquote>
  
  <p>So I tried using a template, but it never rendered a list at all. Instead I get</p>
  
  <ul>
  <li>all properties of the beans <code>toString()</code>ed together</li>
  <li>empty document</li>
  <li>empty <code>&lt;foo /&gt;</code> tag (not <code>&lt;foos /&gt;</code>, strangely)</li>
  </ul>
  
  <p>I couldn't find a tutorial that helped me, neither on Beans->XML rendering nor XSLT. One problem is that I have trouble coming up with good search terms: googling "struts xml" and similar returns a huge amount of completely irrelevant links about stuff in <code>struts.xml</code>, excluding "struts.xml" from the results is no good either, because pages I'm looking for would likely have example struts.xml snippets.</p>
  
  <p>I think I wouldn't really need the templates, so if it's possible to do without, great.</p>