This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]