|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Nodesets as parameters
Hi all,
let me try this again. I want to pass the XSL parser a parameter that is
nodeset. I believe that in theory this should be possible? I know
variables can be nodesets, I'm assuming parameters can also be nodesets?
Based on this assumption, I'm attempting to build a document fragment and
then call the parser:
org.apache.xalan.stree.DocumentFragmentImpl parmDoc
=
new
org.apache.xalan.stree.DocumentFragmentImpl( );
for( Enumeration pr = data.getValues();
pr.hasMoreElements(); ) // Get next parameter value
{
String prn = (String)pr.nextElement();
// Get the parameter name
Element parmE = parmDoc.createElement( prn );
// Create an element with that name
parmE.setAttribute( "value", data.getValue( prn
) ); // Set the value for the element
parmDoc.appendChild( parmE );
// Add the new element to the doc fragment
}
parmDoc.setComplete( true );
transformer.setParameter( "my-parms",
new
org.apache.xpath.objects.XNodeSet( parmDoc ) );
transformer.transform( xmlSource, new StreamResult(
response.getOutputStream( ) ) );
When I attempt to reference the resulting parameter the parse just hangs and
does not return.
I suspect that either I should not be using a DocumentFragmentImpl or that
I'm missing something in the construction of the fragment. The second
theory is somewhat validated by the fact that the call:
parmDoc.getDocumentElement();
which should return the root value for the fragment returns a null value!
However, I see no way to add anything to the document fragment except by
using appendChild, so I don't see any way around this?
Anyone have any ideas?
Peter Hunsberger
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








