Can a Xquery return a concatenated string and an XML element
Hi,
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:*
<payload>
<aa>one</aa>
<bb>two</bb>
<cc>three</cc>
</payload>
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>
<aa>one</aa>
<bb>two</bb>
<cc>three</cc>
</payload>
How can i achieve the same. Please suggest.
Thanks in advance.
Edited by: user9223904 on Mar 18, 2013 3:16 AM