Hi Mats

From: "Mats Noren" <[EMAIL PROTECTED]>
> Hi,
> I have the following xml snippet:
>
> <data ID="doSearch">
> <param name="test"/>
> <param name="test2"/>
> <slask><value-of select="$test"/></slask>
> </data>
> In my Java code, I want to lookup any element of the type value-of with
> the attribute select="$test"..
>
> service.selectNodes("//value-of[@select='$" + paramName + "']");
>
> where service is the data Element in the above XML
> paramName is the value of the name attribute to the param element.
>
> I tried the following XPath-expression with xalan in a stylesheet and it
> worked: //value-of[@select='$test']...
>
> I tried to loose the two slashes at the beginning since the context node
> should be the data element, but I still get an empty list back.
> Any ideas?


The XPath expression //value-of will start at the document and recurse
downwards. If you want to recurse down from just the <data> element you
could try

slask/value-of[@select='$test']

or

*/value-of[@select='$test']

or

.//value-of[@select='$test']

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to