Hi Keith, >> XObject xObj = new XNodeSetForDOM(doc.getChildNodes(), new XPathContext()); >> transformer.setParameter(paramName,xObj);
Try instead, transformer.setParameter(paramName,doc.getDocumentElement()); and then <xsl:copy-of select="$paramName"/> This should work, I just tried this. Xalan will convert doc.getDocumentElement() to node-set automatically. Your exception is most probably being thrown b/c of another XPathContext you use to initialize your XNodeSetForDOM. The only problem here, is that you better avoid using getChildNodes() in the transformer.setParameter() calls. There's confusion b/c Xerces Node's implementation implements both Node and NodeList interfaces. Thanks, Dimitry -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 23, 2003 18:20 To: [EMAIL PROTECTED] Subject: RE: The test conditional doesn't seem to work Ok, It looks like this could be an issue with the way Java is setting the params. Here is the xalan-1 approach to setting params: DOMParser dp = new DOMParser(); dp.parse(parameterData); XObject xObj = new XNodeSet(dp.getDocument ().getChildNodes()); XSLTProcess xsltProcessor ....; xsltProcessor.setStylesheetParam(paramName,xObj); The new xalan-2 code sets params this way: Document doc = XmlUtil.parseDocument(parameterData); XObject xObj = new XNodeSetForDOM(doc.getChildNodes(), new XPathContext()); Transformer transformer ....; transformer.setParameter(paramName,xObj); I wrote a test servlet to run a stylesheet that does a copy: here is the stylesheet: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version ="1.0"> <xsl:output method="xml" version="1.0" encoding="ISO-8859-1"/> <xsl:param name="theParam"/> <xsl:template match="/"> <xsl:copy-of select="$theParam"/> </xsl:template> </xsl:stylesheet> When I ran it; I got an out of bounds exception on the copy-of line of code. Java must be passing in bad data or something. Transformation failed: javax.xml.transform.TransformerException: java.lang.Array IndexOutOfBoundsException ; SystemID: http://pc034144.code3.com:80//public_xsl/debugparam.xsl; Line#: 12; Column#: 42 javax.xml.transform.TransformerException: java.lang.ArrayIndexOutOfBoundsExcepti on at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr ansformerImpl.java:2323) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResul t.java:696) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr ansformerImpl.java:2318) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResul t.java:696) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr ansformerImpl.java:2318) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Tran sformerImpl.java:2185) at org.apache.xalan.transformer.TransformerImpl.transformNode(Transforme rImpl.java:1263) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp l.java:671) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp l.java:1179) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp l.java:1157) at com.mmm.ciws.xsl.StylesheetRoot.process(StylesheetRoot.java:74) at com.mmm.ciws.xsl.XSLTProcessor.process(XSLTProcessor.java:186) at com.mmm.ciws.xsl.TransformXSL.transform(TransformXSL.java:196) at com.mmm.ciws.xsl.TransformXSL.transform(TransformXSL.java:157) at com.mmm.ciws.TestTransform.service(TestTransform.java:125) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run (ServletStubImpl.java:1058) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm pl.java:401) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm pl.java:306) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio n.run(WebAppServletContext.java:5445) at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic eManager.java:780) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe rvletContext.java:3105) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm pl.java:2588) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189) Any and all help would be greatly appreciated. Thanks Keith.... _____________________________________________________ Revere Data, LLC, formerly known as Sector Data, LLC, is not affiliated with Sector, Inc., or SIAC.
