now it's doing what I want it do with MediaWiki API (i.e producing csv of titles and URLs):

xmlstarlet sel -N x="http://opensearch.org/searchsuggest2" -t -m "//x:Item" -v "x:Text" -o ", " -v "x:Description" -o ", " -v "x:Url"  -n bullwinkle.xml

Thanks again.

-----------------------------------------------------
Subscribe to the Nimble Books Mailing List  http://eepurl.com/czS- for monthly updates



On Tue, Jan 10, 2012 at 10:30, Petr Onderka <gsvick@gmail.com> wrote:
If you define namespace alias (in your case "x"), you also have to
actually use it in the query:

xmlstarlet sel -N x=http://opensearch.org/searchsuggest2 -t -v
'count(/x:SearchSuggestion/x:Section/x:Item)' bullwinkle.xml

The command above works for me and returns "7".

And as far as I know, you have to use namespace aliases when working with XPath.

Petr Onderka
[[User:Svick]]

On Tue, Jan 10, 2012 at 00:09, Fred Zimmerman <wfz@nimblebooks.com> wrote:
> bitnami@ip-10-212-187-224:~/sfb-link/scripts$ xmlstarlet sel -N
> x=http://opensearch.org/searchsuggest2 -t -v
> "/SearchSuggestion/Section/Item" bullwinkle.xml
> bitnami@ip-10-212-187-224:~/sfb-link/scripts$
>
> that doesn't work (null response). not sure whether it's xpath or my lack of
> understanding of xmlstarlet.
>
> -----------------------------------------------------
> Subscribe to the Nimble Books Mailing List  http://eepurl.com/czS- for
> monthly updates
>
>
>
> On Mon, Jan 9, 2012 at 17:34, <b-jorsch@alum.northwestern.edu> wrote:
>>
>> On Mon, Jan 09, 2012 at 03:12:23PM -0500, Fred Zimmerman wrote:
>> > > count(/SearchSuggestion/Section/@Item)
>>
>> That's looking for the "Item" in <Section Item="...">, of which none
>> exist in the document. Lose the @ and it might work.
>>
>> _______________________________________________
>> Mediawiki-api mailing list
>> Mediawiki-api@lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>
>
>
> _______________________________________________
> Mediawiki-api mailing list
> Mediawiki-api@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
>

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api