Quantcast
Channel: SCN : All Content - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 7030

XSLT - Data Validation/Manipulation in structures with repetitions

$
0
0

Hi experts,

 

I have a requirement to validate a field content which is within a 1..N structure, so the data come in pairs of RESULT_ID and RESULT_VALUE.

 

If "<" (&lt;) is found in Result.Min_Limit characteristic, its value must be put in the Max_Limit characteristic target field and Min_Limit must be cleared out in target structure.

 

Source structure with data:

<?xml version="1.0" encoding="UTF-8"?>

<TEST>

  <RESULTS>

       <RESULT>

            <D_RESULT>

                 <D_RESULT_ID>Result.Derived</D_RESULT_ID>

                 <D_RESULT_VALUE>59W</D_RESULT_VALUE>

            </D_RESULT>

            <D_RESULT>

                 <D_RESULT_ID>Result.Min_Limit</D_RESULT_ID>

                 <D_RESULT_VALUE>&lt;=600.0000</D_RESULT_VALUE>

            </D_RESULT>

            <D_RESULT>

                 <D_RESULT_ID>Result.Max_Limit</D_RESULT_ID>

                 <D_RESULT_VALUE/>

            </D_RESULT>

            <D_RESULT>

                 <D_RESULT_ID>Result.FailedCriticalLvl</D_RESULT_ID>

                 <D_RESULT_VALUE>false</D_RESULT_VALUE>

            </D_RESULT>

       </RESULT>

  </RESULTS>

</TEST>

 

Target must be as follow:

<?xml version="1.0" encoding="UTF-8"?>

<TEST>

  <RESULTS>

       <RESULT>

            <D_RESULT>

                 <D_RESULT_ID>Result.Derived</D_RESULT_ID>

                 <D_RESULT_VALUE>59W</D_RESULT_VALUE>

            </D_RESULT>

            <D_RESULT>

                 <D_RESULT_ID>Result.Min_Limit</D_RESULT_ID>

                 <D_RESULT_VALUE/>

            </D_RESULT>

            <D_RESULT>

                 <D_RESULT_ID>Result.Max_Limit</D_RESULT_ID>

                 <D_RESULT_VALUE>&lt;=600.0000</D_RESULT_VALUE>

            </D_RESULT>

            <D_RESULT>

                 <D_RESULT_ID>Result.FailedCriticalLvl</D_RESULT_ID>

                 <D_RESULT_VALUE>false</D_RESULT_VALUE>

            </D_RESULT>

       </RESULT>

  </RESULTS>

</TEST>



I've created a variable to store Min_Limit value if it contains the "<" character, and it works fine when the pointer is still in Min_Limit characteristic.

When it flips to next characteristic (Max_Limit), the variable seems to loose its value and therefore I have no visibility of Min_Limit value anymore to assign the value to Max_Limit characteristic.


Not sure if it's well explained, but basically I believe I would be able to solve this puzzle if only I had a global variable to assign Min_Limit and then validate it when Max_Limit comes, but I know there's no Global variable in XSL.


Would anyone suggests an alternative to solve this?


Many thanks!


Viewing all articles
Browse latest Browse all 7030

Trending Articles