How to store value in XSL and syntax for-each?

2019-09-14 07:50发布

问题:

My request XML is :

<?xml version="1.0" encoding="utf-8"?>
<test123 class="test" version="str1234">
    <Header>
        <MYD>str1234</MYID>
    </Header>
    <Body>
        <Action method="Request" type="PROV">
            <Approval>
                <Approval1>1234567890</Approval1>
                <Linked123>
                    <XYZNumber>12345</XYZNumber>
                </Linked123>
                <Version>123</Version>
                <Country level="12"  hasModified="true" isSelected="true">
                    <Year>1999</Year>
                    <Month>Jan</MonthShortName>
                </Country>
                <Version>123</Version>
                <Country level="12"  hasModified="true" isSelected="true">
                    <Year>1990</Year>
                    <Month>May</MonthShortName>
                </Country>
            </Approval>
        </Action>
    </Body>
</test123>

My question is in XSL if field "version" is blank and "Approval1" is blank etc, then I will store all the error (my customise message) for every field in common variable and at the end I will return that variable value to forward requester, so that I will get the consolidated all the error in single variable and return back to user.

And also: how can I use for-each for the field of "country level" as it is repeating two times?