1 Reply Latest reply: Mar 18, 2013 5:36 AM by odie_63 RSS

    Can a Xquery return a concatenated string and an XML element


      My Xquery fucntion is shown below:

      It accepts 4 string parameters and an XML element i.e., $Message which is an XML element(request coming to the service) and i need to log all this information to a log file.

      I am using the below concat fucntion to get a concatenated string of all the parameters but, for $Message i m not able to get the XML payload. How to achieve the same in the Xquery?

      *$Message is the below XML file:*


      My Xquery function is:

      declare function xf:XformLog($Name as xs:string,
      $id as xs:string,
      $Context as xs:string,
      $Annotation as xs:string,
      $Message as element(*))
      as xs:string {
      concat("Name = ",$Name," , ","Id = ",$id," , ","Message Context = ",$Context," , ","Annotation = ",$Annotation," , ","Event Message = ", data($Message/@* , $Message/node()))

      I am trying to achieve the following log:

      Name = xyz, Id = 111, Message Contact = abc, Annotation = ggg, Event Message = <payload>

      How can i achieve the same. Please suggest.

      Thanks in advance.

      Edited by: user9223904 on Mar 18, 2013 3:16 AM