declare option ddtek:sql-options "ignore-trailing-spaces=yes";
<Root>
	{
	for $row in doc('file:///c:/Stylus/txt2xml2.xml')/root/row
	return
	<Customer>
		{
		for $CUST in collection("MYDB.MYLOC.CUST")/CUST
		where $CUST/BVCUST = $row/shipto
		return
		<Cust>
			<CustNum>
				{$CUST/BVCUST/text()}
			</CustNum>
			<CustNam>
				{$CUST/BVNAME/text()}
			</CustNam>
			{
			for $OCRHX71 in collection("MYDB.MYLOC.OCRHX7")/OCRHX7
			where $OCRHX71/DCSCUS = $CUST/BVCUST
			return
			<Order>
				<OrdNum>
					{$OCRHX71/DCORD_x0023_/text()}
				</OrdNum>
				<OrdDat>
					{$OCRHX71/DCODAT/text()}
				</OrdDat>
				<OrdTyp>
					{$OCRHX71/DCOTYP/text()}
				</OrdTyp>
				<OrdPO>
					{$OCRHX71/DCPO/text()}
				</OrdPO>
			</Order>
			}
		</Cust>
		}
	</Customer>
	}
</Root>