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 <[email protected]> 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, <[email protected]> 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 >> [email protected] >> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api > > > > _______________________________________________ > Mediawiki-api mailing list > [email protected] > https://lists.wikimedia.org/mailman/listinfo/mediawiki-api > _______________________________________________ Mediawiki-api mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
