|
Subject: RE: [xsl] Problem setting part of xpath as parameter From: "Michael Kay" <mhk@xxxxxxxxx> Date: Tue, 1 Jun 2004 08:32:40 +0100 |
>
> 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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Problem setting part of xpath as pa, Lillian Djurhuus | Thread | finding namespace-URI for a given p, christof.hoeke |
| RE: [xsl] xmlns="" ??, Michael Kay | Date | finding namespace-URI for a given p, christof.hoeke |
| Month |