HA HA! Triumph! I had to impliment createXsltSource() rather than createDomNode() in my subclass of AbstractXsltView. The API says that createDomNode() should work, though it only exists for backwards compatibility. However, I got the exceptions I mentioned above. I also had to change my xslt stylesheet to print out the proper words. Here is the code I changed from the example in the reference manual (this all concerns Spring 2.0).
So rather than createDomNode() I used createXsltSource:
Code:
protected Source createXsltSource(Map model, String rootName, HttpServletRequest arg2, HttpServletResponse arg3) throws Exception {
org.jdom.Document doc = new org.jdom.Document();
Element root = new Element("words");
doc.setRootElement(root);
List words = (List) model.get("wordList");
for (Iterator it = words.iterator(); it.hasNext();) {
String nextWord = (String) it.next();
System.out.println(nextWord);
Element e = new Element("word");
e.setText(nextWord);
root.addContent(e);
}
System.out.println("Start:");
System.out.println(doc.toString());
System.out.println("Stop:");
Node node = new DOMOutputter().output( doc );
return new DOMSource(node);
}
and here is the xslt:
Code:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="/">
<html>
<head><title>Hello!</title></head>
<body>
<h1>My First Words</h1>
<xsl:for-each select="words/word">
<xsl:value-of select="."/><br />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Thanks for your help,
Dustin