ah, in that case you'd need to use an extensin function eg
saxon:function so you can get the for-each inside the Xpath select
attribute, or use XSLT2/Xpath2 which alows you to go
document('jhg.xml')/key(...)
oh.. thanks!
then I think we better take the other option ($ref variable)
Anton