[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Problem setting part of xpath as parameter

Subject: RE: Problem setting part of xpath as parameter
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 1 Jun 2004 08:32:40 +0100
xpath 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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.