Hi Rob,
I think the best way would be to use a Java method to calculate a random number from 1 to however many prompts you have in the XML and use that in constructing your XPath statement.
I have written a script for the XML shown below. The Elements XML value is an integer that that the script reads do determine how many "P" elements there are.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Campaigns>
<Campaign ID="1">
<Elements>9</Elements>
<P ID="1">abc</P>
<P ID="2">bcd</P>
<P ID="3">cde</P>
<P ID="4">def</P>
<P ID="5">efg</P>
<P ID="6">fgh</P>
<P ID="7">ghi</P>
<P ID="8">hij</P>
<P ID="9">ijk</P>
</Campaign>
</Campaigns>
The script the uses the Java snippet below to generate a random number
iRND=(Math.random() * iElements+1)
It then uses this number to create the XPath query
If you load up my script (you will have to change the dCampaign variable path to match where you store the XML file) and dial it you should hear it randomly playing the contents of the XML file - i.e. abc, hij, ghi etc.
Let me know how you get on.
James