[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Problem setting part of xpath as parameter
> > Im having a problem with a parameter set from java to a xsl document. > It used to work. But moving from version Xalan Java 1 to > Xalan Java 2 it > doesnt anymore. The only thing that surprises me is that this could ever have worked. > > I have the following Java testcode, that makes the transformation: > trans.setParameter("xpath", "Root[1]/Niv0[1]/Niv1[1]/"); > > in the xsl file I have the following: > . > . > . > <xsl:param name="xpath" /> > . > . > <xsl:for-each > select="$xpath/child::node()[@Visible='true'].......more conditions... > > Somehow it cant put the value of the xpath parameter in the select > statement and interpret it as a nodelist. Well, you haven't actually told it that the string you supplied is an XPath expression and you would like it to be evaluated and that when you say $xpath you don't want the string, but the node-set that results from this XPath evaluation. You can't really expect the processor to guess that this is what you wanted! If you supply a string as a parameter, you should use it in the stylesheet as a string. Xalan, I believe, implements the EXSLT dyn:evaluate() extension that allows you to evaluate an XPath expression supplied as a string, returning the node-set containing the selected nodes. Alternatively, you could control this evaluation from the Java application and supply a set of nodes as the parameter value. Michael Kay
|
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
|