I'm creating an xml file from database generated data. Once of the nodes requires a link. I'm using PHP's DOM to generate the file but I'm stuck on how create the xlink and to associate it the required node.

I thought set_namespace might work, but have to include a product id in the link and I'm not sure how to structure it.

These first 5 lines get things rolling and the last 2 lines which are in a foreach loop generate...