Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


xml dml conditional attribute inserting does not work

From: "SammyBar" <sammybar@-----.--->
To: 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 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent