Developer-supplied XSLT params in AbstractXsltView (patch) [SPR-40] #4775
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Aaron Hamid opened SPR-40 and commented
I originally posted this issue on the SourceForge forums (http://sourceforge.net/forum/forum.php?thread_id=1024298&forum_id=250339).
It would be nice to be able to set XSLT parameters in XSLT view. Also, AbstractXsltView for some reason will bomb if no model is supplied in the ModelAndView, even though createDomNode can supply a valid node. This patch includes some of my commentary - remove at will.
--- AbstractXsltViewOriginal.java 2004-02-17 12:39:18.142750000 -0500
+++ AbstractXsltView.java 2004-02-17 12:47:01.674000000 -0500
@@ -8,6 +8,7 @@
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.util.Map;
+import java.util.Iterator;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -168,7 +169,7 @@
}
Node dom = null;
String docRoot = null;
@@ -181,6 +182,10 @@
singleModel = model.get(docRoot);
}
// XXX: not sure what this business is about, but if I have an empty/null model in my ModelAndView
// I consistently get the error: "Cannot domify multiple non-Node objects without a root element name in XSLT view"
// even though I can supply a perfectly fine Dom node from createDomNode
// handle special case when we have a single node
if (singleModel != null && (singleModel instanceof Node)) {
// Don't domify if the model is already an XML node
@@ -199,7 +204,9 @@
dom = createDomNode(model, (docRoot == null) ? this.root : docRoot, request, response);
}
}
/**
@@ -219,14 +226,42 @@
HttpServletResponse response) throws Exception;
/**
@param
model the model Map@param
root name for root element@param
request HTTP request. Subclasses won't normally use this, as@param
response HTTP response. Subclasses won't normally use this,@throws
Exception we let this method throw any exception; the*/
protected void doTransform(HttpServletResponse response, Node dom, Map parameters) throws ServletException, IOException {
try {
Transformer trans = (this.templates != null) ?
this.templates.newTransformer() : // we have a stylesheet
this.transformerFactory.newTransformer(); // just a copy
No further details from SPR-40
The text was updated successfully, but these errors were encountered: