Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating XSLT transform to flatten multiRef encoded SOAP message
    primarykey
    data
    text
    <p>Input is a mutliRef encoded SOAP message/document. How do you use XSLT to flatten multiRefs. Multiref nodes can be referenced used multiple times, and themselves recursively reference other multiRef nodes. </p> <p>The only pieces of the structure that are safe to refer to, are multiRef elements and @id and @href attributes. Other elements or namespaces could change.</p> <p>Sample input message is:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;soapenv:Body&gt; &lt;ns1:getAccountDTOResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://www.example.com/pw/services/PWServices"&gt; &lt;getAccountDTOReturn href="#id0" /&gt; &lt;/ns1:getAccountDTOResponse&gt; &lt;multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Account" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:PWServices"&gt; &lt;ID href="#id1" /&gt; &lt;accountNumber xsi:type="soapenc:string"&gt;&lt;/accountNumber&gt; &lt;accountType xsi:type="soapenc:string"&gt;&lt;/accountType&gt; &lt;clientData xsi:type="soapenc:Array" xsi:nil="true" /&gt; &lt;name xsi:type="soapenc:string"&gt;&lt;/name&gt; &lt;parentRef xsi:type="soapenc:string"&gt;&lt;/parentRef&gt; &lt;/multiRef&gt; &lt;multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"&gt; 0&lt;/multiRef&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre> <p>Expected output is:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;soapenv:Body&gt; &lt;ns1:getAccountDTOResponse xmlns:ns1="http://www.example.com/pw/services/PWServices" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt; &lt;getAccountDTOReturn xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:PWServices" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Account"&gt; &lt;ns1:ID soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:long"&gt;0&lt;/ns1:ID&gt; &lt;ns1:accountNumber xsi:type="soapenc:string" /&gt; &lt;ns1:accountType xsi:type="soapenc:string" /&gt; &lt;ns1:clientData xsi:type="soapenc:Array" xsi:nil="true" /&gt; &lt;ns1:name xsi:type="soapenc:string" /&gt; &lt;ns1:parentRef xsi:type="soapenc:string" /&gt; &lt;/getAccountDTOReturn&gt; &lt;/ns1:getAccountDTOResponse&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre> <p><strong>Update:</strong> In the example above, logically, what should happen is:</p> <p>On the first pass, getAccountDTOResponse contains @href="#id0", so that element is replaced with all the children multiRef element with @id="id0", with exception of.</p> <p>On the second pass, @href="#id1" should be discovered, and ID element should be replaced with contents of element with @id="id1". </p> <p>No multiRef elements should exists in the output. No attributes @id or @href should exists in output, if there were involved in this whole multiRef mess.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload