You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by "Edward Q. Bridges" <eb...@argotec.de> on 2001/10/05 13:04:51 UTC

Sample program Apply XPath weirdness

when i try to run ApplyXPath thusly:
java ApplyXPath foo.xml  /doc/name[@first=David]

foo.xml is the sample xml file included with the sample, and looks like this:
<doc>
   <name first="David" last="Marston"/>
   <name first="David" last="Bertoni"/>
   <name first="Donald" last="Leslie"/>
   <name first="Emily" last="Farmer"/>
....
</doc>

it returns empty output:
<output>
</output>

when it *should* return
<output>
<name first="David" last="Marston"/>
<name first="David" last="Bertoni"/>
</output>

or, am i missing something?

my reason for pointing this out (besides pedantry) is that i was hoping to
use this as the basis for a component of an application where i want return a
subtree from a larger document using an xpath query.

if someone has a snippet like that that works, i would appreciate it too.

many thanks
--e--


--------------------------------------------
<argo_tec gmbh>
     ed.q.bridges
     tel. 089-368179.552
     fax 089-368179.79
     osterwaldstraße 10 
     (haus F eingang 21)
     80805 münchen
</argo_tec gmbh>
--------------------------------------------  



Sample program Apply XPath weirdness (Addendum)

Posted by "Edward Q. Bridges" <eb...@argotec.de>.
please note, i am using xalan-j_2_2_D6



On Fri, 05 Oct 2001 13:04:51 +0200, Edward Q. Bridges wrote:

>when i try to run ApplyXPath thusly:
>java ApplyXPath foo.xml  /doc/name[@first=David]
>
>foo.xml is the sample xml file included with the sample, and looks like this:
><doc>
>   <name first="David" last="Marston"/>
>   <name first="David" last="Bertoni"/>
>   <name first="Donald" last="Leslie"/>
>   <name first="Emily" last="Farmer"/>
>....
></doc>
>
>it returns empty output:
><output>
></output>
>
>when it *should* return
><output>
><name first="David" last="Marston"/>
><name first="David" last="Bertoni"/>
></output>
>
>or, am i missing something?
>
>my reason for pointing this out (besides pedantry) is that i was hoping to
>use this as the basis for a component of an application where i want return a
>subtree from a larger document using an xpath query.
>
>if someone has a snippet like that that works, i would appreciate it too.
>
>many thanks
>--e--
>

--------------------------------------------
<argo_tec gmbh>
     ed.q.bridges
     tel. 089-368179.552
     fax 089-368179.79
     osterwaldstraße 10 
     (haus F eingang 21)
     80805 münchen
</argo_tec gmbh>
--------------------------------------------