Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This stylesheet:</p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"&gt; &lt;xsl:key name="kMultiRefById" match="multiRef" use="@id"/&gt; &lt;xsl:output method="xml"/&gt; &lt;xsl:template match="node()|@*"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="node()|@*"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;xsl:template match="getAccountDTOReturn"&gt; &lt;xsl:variable name="vRefer" select="key('kMultiRefById',substring(@href,2))"/&gt; &lt;xsl:copy&gt; &lt;xsl:copy-of select="$vRefer/namespace::*"/&gt; &lt;xsl:apply-templates select="$vRefer/@*|$vRefer/node()"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;xsl:template match="multiRef|multiRef/@id|multiRef/@soapenc:root"/&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>Output:</p> <pre><code>&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 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;/ID&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;/clientData&gt; &lt;name xsi:type="soapenc:string"&gt;&lt;/name&gt; &lt;parentRef xsi:type="soapenc:string"&gt;&lt;/parentRef&gt; &lt;/getAccountDTOReturn&gt; &lt;/ns1:getAccountDTOResponse&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre> <p><strong>Note</strong>: Keys for cross references. Identity rule. Empty rules for stripping. <strong>Copying namespaces nodes might not be posible for every XSLT processor</strong>, although I only know about Mozilla's TransforMiiX wich doesn't have implemented <code>namespaces::</code> axis.</p>
 

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