You want to use the nesting roll query concept to escape characters of calls/macros inside of others:
https://wiki.roll20.net/Macros#Example_.28nesting_...each attack can be written as (for the selected token):
%{selected|repeating_weapon_$X_attack-roll}
where X is the row starting with 0. (generally should be the same as the # that appears next to the expand/collapse arrow) And you'll have to know how many weapons beforehand, there is no way to dynamically determine that without using the API and writing javascript.
then you nest a bunch of those inside the ? query by escaping the special characters with their html code equivalents.
So this SHOULD work for the first 2 items: (i have not tested this but basically i just substituted the above in for ?{attack with|1,attk1|2,attk2}
(remove the spaces between & and #, had to put those in for the forums here )
?{attack with|1,& #37;& #123;selected& #124;repeating_weapon_$1_attack-roll& #125;|2,& #37;& #123;selected& #124;repeating_weapon_$2_attack-roll& #125;}
or if you want to use the name of the attack in the dropdown:
?{attack with|& #64;{selected& #124;repeating_weapon_$1_name& #125;,& #37;& #123;selected& #124;repeating_weapon_$1_attack-roll& #125;|& #64;&# 123;selected& #124;repeating_weapon_$2_name& #125;,& #37;& #123;selected& #124;repeating_weapon_$2_attack-roll& #125;}