I completely agree. It would great if a sample was available that showed 
how to work with beans as parameters.




"Eric J. Schwarzenbach" <[EMAIL PROTECTED]> 
05/24/2007 04:16 PM

To
xalan-j-users@xml.apache.org
cc

Subject
Thoughts on Transformer parameter passing






Reading some of the recent messages about parameter passing, lead me to
considering some of my own parameter passing code habits, and to look at
the documentation again.

The Javadoc for javax.xml.transform.Transformer.setParameter(name,
value) says of value "This can be any valid Java object. It is up to the
processor to provide the proper object coersion or to simply pass the
object on for use in an extension." (It's not clear to me if it is
assumed there is a single "proper" mapping of Java objects to XSLT
constructs, or if that too is up to the implementation to decide.)

On the Xalan-Java site, the FAQ is silent on parameter passing, and the
Usage Patterns just refers to the UseStylesheetParam.java sample. That
sample shows only the simplest most obvious case, passing a String.

This topic seems to cry out for treatment in the FAQ. At the very least
shouldn't Xalan's mapping of Java objects to XSLT constructs be
documented somewhere?

Where I work, we typically pass XML fragments as parameters, by creating
a Document and the necessary Element, Atribute and Text nodes with a
DocumentBuilder, and then putting that into a NodeList (currently we
have a very simple ArrayList-based implementation of that interface that
we use for that purpose) and pass that. I cannot remember what
combination of trial and error and searching the web for random postings
on the matter that resulted in our arriving at this procedure, and I'm
by no means confident that this is the best way to go about it. I do
recall having seen it struggled with at several companies I've worked at
prior to getting into the XSLT side of things myself, due to the general
scarcity of good information on the topic.

Also, reading the recent posts and their references gives me no idea if
the practice I outlined above will continue to work if we start using
XSLTC, and if not, whether that should be considered a bug or simply a
limitation of the how this implementation chooses to do its object
coersion. Can someone tell me?

Eric


Reply via email to