Monday, August 20, 2007

Working with saxon

Saxon didn't like the concatenation of the sequence. changing this to fn:string-join worked however.


declare namespace xf = "http://tempuri.org/xqueryTest/XQueryTransformations/csv/";

declare function xf:csv($aPIMessage1 as element(APIMessage))
as xs:string {
fn:string-join(
for $line in $aPIMessage1/AuthResponse
let $ct := concat($line/ClientTransactionReference, "," , $line/SystemReferenceNumber, ",", $line/ResponseInfo/ResponseCode , ",", $line/ResponseInfo/Result ,",", $line/ResponseInfo/Description , ",", $line/ApprovalInfo/ApprovalCode , ",", $line/ApprovalInfo/DateTime, " ")
return $ct,"")
};


declare variable $aPIMessage1 as element(APIMessage) external;

xf:csv(doc("./resp.xml")/APIMessage)

No comments: