Hi Harm

I think this has been fixed now in the trunk by veithen. What he has done is, after selecting a source , make a note whether the source is a soap body or a soap envelope or a just element. If the source is a soap envelope, result is set as the soap envelope of the MessageContext, if the source is a soap body, then, remove all children from the source and add all children of result as new children. If the source is a just element, then replace it with the result.

So, with synapse trunk source="/soapenv:Envelope/soapenv:Body" or source="/soapenv:Envelope" should work.

I just have tried by modifying sample 8 as follows. It works

Xslt mediator configuration

<xslt key="xslt-key-req" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/";

               xmlns:s12="http://www.w3.org/2003/05/soap-envelope";

               source="s11:Body | s12:Body"/>


xslt file

<xsl:stylesheet version="2.0"

               xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

               xmlns:fn="http://www.w3.org/2005/02/xpath-functions";

               xmlns:m0="http://services.samples/xsd";

               xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/";

               xmlns:s12="http://www.w3.org/2003/05/soap-envelope";

               exclude-result-prefixes="m0 fn">

   <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>



   <xsl:template match="/">

       <xsl:apply-templates select="//s11:Body | //s12:Body"/>

   </xsl:template>



   <xsl:template match="s11:Body | s12:Body">

    *   **<x>*

       <m:getQuote xmlns:m="http://services.samples/xsd";>

           <m:request1>

               <m:symbol>

                   <xsl:value-of select="m0:CheckPriceRequest/m0:Code"/>

               </m:symbol>

           </m:request1>

       </m:getQuote>

       <m:getQuote xmlns:m="http://services.samples/xsd";>

           <m:request2>

               <m:symbol>

                   <xsl:value-of select="m0:CheckPriceRequest/m0:Code"/>

               </m:symbol>

           </m:request2>

       </m:getQuote>

     * **</x>*

   </xsl:template>

</xsl:stylesheet>



Out put


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>

   <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing";>

       <wsa:To>http://localhost:9000/soap/SimpleStockQuoteService</wsa:To>

<wsa:MessageID>urn:uuid:B28F2EA1B3D38D56471224869871168</wsa:MessageID>

       <wsa:Action>urn:getQuote</wsa:Action>

   </soapenv:Header>

   <soapenv:Body>

       <m:getQuote xmlns:m="http://services.samples/xsd";>

           <m:request1>

               <m:symbol/>

           </m:request1>

       </m:getQuote>

       <m:getQuote xmlns:m="http://services.samples/xsd";>

           <m:request2>

               <m:symbol/>

           </m:request2>

       </m:getQuote>

   </soapenv:Body>

</soapenv:Envelope>



And if the xslt transformation returns multiple same level elements (siblings) without enclosing with an outter element then, AXIOM only build first child from that out put stream of the transformation. Any valid XML document instance has a single root element, so XML parser may be give one element out of all or an error. Therefore, make sure, that the output is always contain a root element.

Thanks
Indika






_______________________________________________
Esb-java-user mailing list
[email protected]
http://mailman.wso2.org/cgi-bin/mailman/listinfo/esb-java-user

Reply via email to