Hi Sateesh,
I’m not sure about the details of your query (e.g. I wonder if you really want to check if the string ACH99223852 contains the order number, which feels a little bit weird), but the attached query may do what you need. Do you store all your documents in a database, or is this no option?
Christian ___________________________________
let $no := 'ACH99223852' let $itemized := doc('Sample.xml')/SUBCUSTBRK[ORDRNO/@NO = $no]/ITEMIZED/TRANSACTION[@Type="OrderCharges"]/ORDER_TYPES[@TYPE="Order to Mobile"]/DATA/R return <DOCUMENT>{ for $row in $itemized return <R> { $row/* } <ORDRNO>{ $no }</ORDRNO> </R> }</DOCUMENT>