Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2878

Re: Trouble using tt:switch / tt:switch-var in simple transformation

$
0
0

I can't answer your questions, as ST is not easy to understand. So, you could simplify your ST, transfer all PARAM nodes, and exclude the "bus" node using ABAP.

 

Program:

types : begin of ty_ls_param,          paramname  TYPE string,          paramvalue TYPE string,        end of ty_ls_param.
data lt_params TYPE TABLE OF ty_ls_param.
data string type string.
concatenate        '<?xml version="1.0" encoding="UTF-16"?>'        '<PARAMS>'        '    <PARAM name="Name">GPS Antenna'        '    <PARAM name="Status">Connected'        '    <PARAM name="bus">test bus'        '</PARAMS>'
into string.
try.
call transformation ztest source xml string result data = lt_params.
data lx_root type ref to cx_root.
catch cx_root into lx_root.
endtry.
DELETE lt_params WHERE paramname = 'bus'. BREAK-POINT.

Transformation "ztest":

<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates"><tt:root name="DATA"/>
<tt:template>
    <PARAMS>
        <tt:loop ref="DATA">
            <PARAM>
                <tt:attribute name="name" value-ref="PARAMNAME"/>
                <tt:d-cond><bus><tt:skip/></bus></tt:d-cond>
                <tt:value ref="PARAMVALUE"/>
            </PARAM>
        </tt:loop>
    </PARAMS>
</tt:template></tt:transform>

Viewing all articles
Browse latest Browse all 2878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>