Subject:Attribute - XSD, DataDirect, XQuery and XML output Author:Ivan Pedruzzi Date:04 Aug 2011 03:40 PM
May,
I can see several problems
What you are trying to accomplish with the following? Do you need to generate a Transactional or a DTOApplication element for each record in the XML_Application?
for $_x0058_ML_Application in collection("MSRB_Test_be.dbo.XML_Application")/_x0058_ML_Application/AppModID
return
<Transactional>
{
for $_x0058_ML_Application2 in collection("MSRB_Test_be.dbo.XML_Application")/_x0058_ML_Application/ApplicationNumber
return
In regards of the duplicate attribute values, see the following changes
for $_x0058_ML_Application2 in collection("MSRB_Test_be.dbo.XML_Application")/_x0058_ML_Application
return
<DTOApplication
ApplicationNumber="{ $_x0058_ML_Application2/ApplicationNumber}"
CustomerRef="{$_x0058_ML_Application2/CustomerRef}"
Description="{$_x0058_ML_Application2/Description}"
... and several others
Every time you see a call to the collection function inside an attribute value you should be suspicious.
The following where statement also sounds suspicious, it should express a relationship between the tables XML_Building and XML_Line
for $_x0058_ML_Building in collection("MSRB_Test_be.dbo.XML_Building")/_x0058_ML_Building
where collection("MSRB_Test_be.dbo.XML_Line")/_x0058_ML_Line