Hi,
> [2] Then use another XPath expression to obtain the ID of the book
> having the title chosen by the user. Something like:
>
> <get expression="//bo...@title='%_']/@id"/>
Your solution rests on the assumption that all titles in the document should
be unique, which may not necessarily be the case...
If the pick command could (optionally, of course) return the *index* of the
selected item (like e.g. JList's getSelectedIndex method or similar methods
of ListBox-like controls in other languages), perhaps this problem could be
solved in a way similar to this:
<set variable="ids" expression="//book/@id"/>
<set variable="titles" expression="concat('"', join(//book/@title,
'" "'), '"')" plainString="false" />
<command name="pick" parameter="'Select a title'
some-new-get-index-instead-of-value-parameter $titles"/>
<get expression="$ids[%_]"/> <!-- is it possible to index into a user
variable? -->
I suspect that there may be other scenarios when the pick command returning
the index rather than value of the selected item could prove helpful.
Is there any hope that such a functionality could be implemented in the
future?
Best regards,
Mariusz Idzikowski