Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] Problem setting part of xpath as parameter

From: "Michael Kay" <mhk@--------->
To:
Date: 6/1/2004 9:33:00 AM
> 
> 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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent