Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - RE: xml dml conditional attribute inserting does not work xml dml conditional attribute inserting does not workTo: NULL Date: 7/1/2008 2:18:00 PM Hi, I'm experimenting with XML DML. I need to add an attribute only if it meet some condition. But I can not use an sql variable to implement the condition. The following example gives me an error: XQuery [modify()]: An expression was expected Declare @sSerie Varchar(10) ,@sFolio Varchar(10) Declare @xmlCfd xml Set @xmlCfd = '' Set @xmlCfd.modify(' declare namespace cfd="http://www.sat.gob.mx/cfd/2"; insert ( <Comprobante> { if ({sql:variable("@sSerie")} = 2) then attribute serie {sql:variable("@sSerie")} else () ,attribute folio {sql:variable("@sFolio")} } </Comprobante> ) into (/)[1]' ) Select @xmlCfd Obviously, the condition I need should look like if ({sql:variable("@sSerie")} != '') How to implement such an expression? Any hint is welcomed Thanks in advance Sammy | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
