Note that there are some explanatory texts on larger screens.

plurals
  1. POXSLT Conversion with matching of nodes and sum.
    primarykey
    data
    text
    <p>I have the following xml for conversion:</p> <pre><code>&lt;IFX xmlns="http://www.ifxforum.org/181/ifxschema"&gt; &lt;MediaSvcRq&gt; &lt;MediaAcctAdjAddRq&gt; &lt;MediaAcctAdjInfo&gt; &lt;MediaTrnType&gt;Dispense&lt;/MediaTrnType&gt; &lt;CurAmt&gt; &lt;Amt&gt;1800.00&lt;/Amt&gt; &lt;CurCode&gt;PHP&lt;/CurCode&gt; &lt;/CurAmt&gt; &lt;MediaItem&gt; &lt;MediaContainerId&gt;Cassette 2&lt;/MediaContainerId&gt; &lt;MediaType&gt;Cash&lt;/MediaType&gt; &lt;Count&gt;3&lt;/Count&gt; &lt;MediaBal&gt; &lt;CurAmt&gt; &lt;Amt&gt;500.00&lt;/Amt&gt; &lt;CurCode&gt;PHP&lt;/CurCode&gt; &lt;/CurAmt&gt; &lt;MediaTotal&gt; &lt;MediaTotalType&gt;Dispensed&lt;/MediaTotalType&gt; &lt;Count&gt;3&lt;/Count&gt; &lt;/MediaTotal&gt; &lt;/MediaBal&gt; &lt;/MediaItem&gt; &lt;MediaItem&gt; &lt;MediaContainerId&gt;CashRetainBin&lt;/MediaContainerId&gt; &lt;MediaType&gt;Cash&lt;/MediaType&gt; &lt;Count&gt;3&lt;/Count&gt; &lt;MediaBal&gt; &lt;CurAmt&gt; &lt;Amt&gt;500.00&lt;/Amt&gt; &lt;CurCode&gt;PHP&lt;/CurCode&gt; &lt;/CurAmt&gt; &lt;MediaTotal&gt; &lt;MediaTotalType&gt;Retained&lt;/MediaTotalType&gt; &lt;Count&gt;3&lt;/Count&gt; &lt;/MediaTotal&gt; &lt;/MediaBal&gt; &lt;/MediaItem&gt; &lt;MediaItem&gt; &lt;MediaContainerId&gt;Cassette 3&lt;/MediaContainerId&gt; &lt;MediaType&gt;Cash&lt;/MediaType&gt; &lt;Count&gt;3&lt;/Count&gt; &lt;MediaBal&gt; &lt;CurAmt&gt; &lt;Amt&gt;100.00&lt;/Amt&gt; &lt;CurCode&gt;PHP&lt;/CurCode&gt; &lt;/CurAmt&gt; &lt;MediaTotal&gt; &lt;MediaTotalType&gt;Dispensed&lt;/MediaTotalType&gt; &lt;Count&gt;3&lt;/Count&gt; &lt;/MediaTotal&gt; &lt;/MediaBal&gt; &lt;/MediaItem&gt; &lt;MediaItem&gt; &lt;MediaContainerId&gt;CashRetainBin&lt;/MediaContainerId&gt; &lt;MediaType&gt;Cash&lt;/MediaType&gt; &lt;Count&gt;3&lt;/Count&gt; &lt;MediaBal&gt; &lt;CurAmt&gt; &lt;Amt&gt;100.00&lt;/Amt&gt; &lt;CurCode&gt;PHP&lt;/CurCode&gt; &lt;/CurAmt&gt; &lt;MediaTotal&gt; &lt;MediaTotalType&gt;Retained&lt;/MediaTotalType&gt; &lt;Count&gt;3&lt;/Count&gt; &lt;/MediaTotal&gt; &lt;/MediaBal&gt; &lt;/MediaItem&gt; &lt;/MediaAcctAdjInfo&gt; &lt;/MediaAcctAdjAddRq&gt; &lt;/MediaSvcRq&gt; &lt;/IFX&gt; </code></pre> <p>And I would like to have the following output:</p> <pre><code>&lt;XML&gt; &lt;!--Information of Message Container ID: Cassette 1--&gt; &lt;F70&gt;&lt;!--//MediaItem/MediaBal/CurAmt/Amt--&gt; &lt;/F70&gt; &lt;F71&gt;&lt;!--//MediaItem/MediaBal/CurAmt/CurCode--&gt; &lt;/F71&gt; &lt;F72&gt;&lt;!--//MediaItem/MediaBal/MediaTotal/Count--&gt; &lt;/F72&gt; &lt;!--Information of Message Container ID: Cassette 2--&gt; &lt;F73&gt;&lt;!--//MediaItem/MediaBal/CurAmt/Amt--&gt; 500.00 &lt;/F73&gt; &lt;F74&gt;&lt;!--//MediaItem/MediaBal/CurAmt/CurCode--&gt; PHP &lt;/F74&gt; &lt;F75&gt;&lt;!--//MediaItem/MediaBal/MediaTotal/Count--&gt; 3 &lt;/F75&gt; &lt;!--Information of Message Container ID: Cassette 3--&gt; &lt;F76&gt;&lt;!--//MediaItem/MediaBal/CurAmt/Amt--&gt; 100.00 &lt;/F76&gt; &lt;F77&gt;&lt;!--//MediaItem/MediaBal/CurAmt/CurCode--&gt; PHP &lt;/F77&gt; &lt;F78&gt;&lt;!--//MediaItem/MediaBal/MediaTotal/Count--&gt; 3 &lt;/F78&gt; &lt;!--Information of Message Container ID: Cassette 4--&gt; &lt;F79&gt;&lt;!--//MediaItem/MediaBal/CurAmt/Amt--&gt; &lt;/F79&gt; &lt;F80&gt;&lt;!--//MediaItem/MediaBal/CurAmt/CurCode--&gt; &lt;/F80&gt; &lt;F81&gt;&lt;!--//MediaItem/MediaBal/MediaTotal/Count--&gt; &lt;/F81&gt; &lt;F82&gt;&lt;!--Sum of //MediaItem/Count for CashRetainBin--&gt; &lt;/F82&gt; </code></pre> <p></p> <p>For each Cassette, I have tried the following:</p> <pre><code>&lt;F70&gt; &lt;xsl:value-of select="//ifx:MediaSvcRq/ifx:MediaAcctAdjAddRq/ifx:MediaAcctAdjInfo/ifx:MediaItem[ifx:MediaContainerId='Cassette 1']/ifx:MediaBal/ifx:CurAmt/ifx:Amt"/&gt; &lt;/F70&gt; </code></pre> <p>I think matching the Cassettes would work.</p> <p>The problem I have is the sum of CashRetainBin. How can I match the Message Container ID to get the sum of CashRetainBin? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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