Re: xpath string as parameter from java
Mike Brown <[email protected]>
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
Mike Brown wrote:
> Natascia De Bortoli wrote:
> > Hello at all!!
> > I need a method to pass a string as an XPATH query to a xsl file.
>
> If you are using a processor that natively supports exsl:evaluate(),
> then you can pass the XPath expression, as a string, as a stylesheet
> parameter. Your Java code is fine. Instead of using exsl:node-set()
> in your XSLT, you need to use exsl:evaluate(). I hope this helps.
Sorry, I meant dyn:evaluate() ... the prefix ('dyn' vs 'exsl') does
not matter, but the namespace it is bound to is important. It needs
to be "http://exslt.org/dynamic"
The function is described at
http://exslt.org/dyn/functions/evaluate/index.html
Note that the only Java XSLT processor listed as supporting it is Xalan-J.
Saxon supports it only as saxon:evaluate() ... the namespace must be
"http://saxon.sf.net/"