You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Heike Franosch <fr...@bms.de> on 2001/05/22 13:45:15 UTC
Q: howto filter on node content?
Hi,
I played around with ApplyXPath and filtering on attributes works really
fine.
What I am trying to do now is selecting nodes according to their content.
For example the following xml:
<?xml version="1.0"?>
<doc>
<foo>blub</foo>
<foo>bar</foo>
</doc>
I tried all variations of
java ApplyXPath foo.xml "/doc[foo='bar']"
which returns all foo elements, instead of just the second.
Can anyone help, please?
Thanks, Heike
Re: Q: howto filter on node content?
Posted by René Jensen <lu...@tbkol.dk>.
Citat Heike Franosch <fr...@bms.de>:
> Hi,
>
> I played around with ApplyXPath and filtering on attributes works
> really
> fine.
> What I am trying to do now is selecting nodes according to their
> content.
> For example the following xml:
>
> <?xml version="1.0"?>
> <doc>
> <foo>blub</foo>
> <foo>bar</foo>
> </doc>
>
> I tried all variations of
> java ApplyXPath foo.xml "/doc[foo='bar']"
> which returns all foo elements, instead of just the second.
>
> Can anyone help, please?
>
> Thanks, Heike
Well I havn't tried this myself but i think:
java ApplyXPath foo.xml "/doc/foo[text()='bar']"
should do the trick.
\\|//
(@ @)
-----oOOo-(_)-oOOo-----
René Jensen
lundeman@tbkol.dk