1)如果在 2 个不同的策略上有多个实例具有 CategoryCd = GL 和 selectedInd = 'Y' 和 deleteInd = 'Y',则返回代码 FAILURE 并返回原因代码 MANYPOL
<policy VERSION_NO="1" MC_ID="66" ID="1">
<businessGroupCdGvngOrgn>14</businessGroupCdGvngOrgn>
<linesOfInsurance>
<underlyingPolicy>
<PolicyNo>22</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="5">
<PolicyNo>22</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>N</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="4">
<PolicyNo>11</PolicyNo>
<deletedInd>N</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="3">
<PolicyNo>11</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
</linesOfInsurance>
</policy>
Expected O/P:
<AdaptikXML>
<PWResponse>
<ReturnCode>FAILURE</ReturnCode>
<ReturnReasonCode>MANYPOL</ReturnReasonCode>
<PWData>
<policy VERSION_NO="1" MC_ID="66"/>
</PWData>
</PWResponse>
</AdaptikXML>
--------------------------------------------------------------------------------
2) 如果多个实例在同一策略上具有底层策略类别 Cd = GL 和 selectedInd = 'Y' 和已删除Ind = 'Y',则返回代码 FAILURE 并返回原因代码 MANY
<policy VERSION_NO="1" MC_ID="34">
<businessGroupCd>14</businessGroupCd>
<linesOfInsurance>
<underlyingPolicy>
<PolicyNo>22</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>N</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="5">
<PolicyNo>22</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>N</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="4">
<PolicyNo>11</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="3">
<PolicyNo>11</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
</linesOfInsurance>
</policy>
Expected O/P:
<AdaptikXML>
<PWResponse>
<ReturnCode>FAILURE</ReturnCode>
<ReturnReasonCode>MANY</ReturnReasonCode>
<PWData>
<policy VERSION_NO="1" MC_ID="34"/>
</PWData>
</PWResponse>
</AdaptikXML>
--------------------------------------------------------------------------------
3) 如果 MANYPOL 和 MANY 条件都为真,则应返回 MANYPOL(这意味着您可以先检查 MANYPOL 条件,如果为真,您可以停止处理并返回
<policy VERSION_NO="1" MC_ID="66">
<businessGroupCdGvngOrgn>14</businessGroupCdGvngOrgn>
<linesOfInsurance>
<underlyingPolicy>
<PolicyNo>22</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="5">
<PolicyNo>22</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>N</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="4">
<PolicyNo>11</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="3">
<PolicyNo>11</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
</linesOfInsurance>
</policy>
EXPECTED O/P:
<AdaptikXML>
<PWResponse>
<ReturnCode>FAILURE</ReturnCode>
<ReturnReasonCode>MANYPOL</ReturnReasonCode>
<PWData>
<policy VERSION_NO="1" MC_ID="66"/>
</PWData>
</PWResponse>
</AdaptikXML>
4)如果没有具有底层策略类别 Cd = GL 和 selectedInd = 'Y' 和已删除Ind = 'Y' 的实例,则返回代码 = 成功,返回原因代码 NOCHANGE
<policy VERSION_NO="1" MC_ID="56">
<businessGroupCdGvngOrgn>14</businessGroupCdGvngOrgn>
<linesOfInsurance>
<underlyingPolicy ID="8">
<PolicyNo>33</PolicyNo>
<deletedInd>N</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>AL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="7">
<PolicyNo>33</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>N</selectedInd>
<CategoryCd>AL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy>
<PolicyNo>22</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>N</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="5">
<PolicyNo>22</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>N</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="4">
<PolicyNo>11</PolicyNo>
<deletedInd>N</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="3">
<PolicyNo>11</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>N</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
</linesOfInsurance>
</policy>
Expected O/P:
<AdaptikXML>
<PWResponse>
<ReturnCode>SUCCESS</ReturnCode>
<ReturnReasonCode>NOCHANGE</ReturnReasonCode>
<ReturnMessage/>
<PWData>
<policy VERSION_NO="1" MC_ID="56"/>
</PWData>
</PWResponse>
</AdaptikXML>
测试用例 3 - 2 个 GL 策略,每个策略有 2 个报价版本。策略 22 版本 1 已选择Ind = 'Y' AND 已删除Ind = 'Y',策略 11 版本 1 已选择Ind = 'Y' AND deleteInd = 'N'。其他 2 个版本选择了 Ind = 'N' 和已删除的Ind = 'Y'。最终结果应该是策略 22 版本 1 选择了 Ind = 'Y' 并删除了Ind = 'N',策略 11 版本 1 选择了 Ind = 'N' AND deleteInd = 'Y'。
<policy VERSION_NO="1" MC_ID="66">
<businessGroupCdGvngOrgn>14</businessGroupCdGvngOrgn>
<linesOfInsurance> <underlyingPolicy>
<PolicyNo>22</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>N</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="5">
<PolicyNo>22</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="4">
<PolicyNo>11</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>N</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="3">
<PolicyNo>11</PolicyNo>
<deletedInd>N</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
</linesOfInsurance>
</policy>
预期运营
:<AdaptikXML>
<PWResponse>
<ReturnCode>SUCCESS</ReturnCode>
<ReturnReasonCode>CHANGE</ReturnReasonCode>
<ReturnMessage/>
<PWData>
<policy VERSION_NO="1" MC_ID="66" ExtAction="U">
<linesOfInsurance ExtAction="U">
<underlyingPolicy ID="5" ExtAction="U">
<PolicyNo>22</PolicyNo>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<deletedInd>N</deletedInd>
</underlyingPolicy>
<underlyingPolicy ID="3" ExtAction="U">
<PolicyNo>11</PolicyNo>
<VersionNbr>1</VersionNbr>
<selectedInd>N</selectedInd>
<deletedInd>Y</deletedInd>
</underlyingPolicy>
</linesOfInsurance>
</policy>
</PWData>
</PWResponse>
</AdaptikXML>
-____
测试用例 4 - 2 个 AL 策略,1 个具有 2 个报价版本,1 个具有 3 个报价版本。策略 33 版本 1 已选择Ind = 'Y' AND 已删除Ind = 'Y',策略 44 版本 2 已选择Ind = 'Y' AND 已删除Ind = 'Y'。最终结果应该是策略 33 版本 1 和策略 44 版本 2 已选择Ind = 'Y' AND deleteInd = 'N'。策略 33 版本 2 和策略 44 版本 1 已选择Ind = 'N' 并删除Ind = 'Y'。策略 44 版本 3 保持不变(选择Ind = 'N' AND deleteInd = 'Y')
<policy VERSION_NO="1" MC_ID="55">
<businessGroupCdGvngOrgn>14</businessGroupCdGvngOrgn>
<linesOfInsurance>
<underlyingPolicy ID="7">
<PolicyNo>44</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>3</VersionNbr>
<selectedInd>N</selectedInd>
<CategoryCd>AL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy>
<PolicyNo>44</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>AL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="5">
<PolicyNo>44</PolicyNo>
<deletedInd>N</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>AL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="4">
<PolicyNo>33</PolicyNo>
<deletedInd>N</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>AL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="3">
<PolicyNo>33</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>AL</CategoryCd>
</underlyingPolicy>
</linesOfInsurance>
</policy>
预期 o/p:
<AdaptikXML>
<PWResponse>
<ReturnCode>SUCCESS</ReturnCode>
<ReturnReasonCode>CHANGE</ReturnReasonCode>
<ReturnMessage/>
<PWData>
<policy VERSION_NO="1" MC_ID="55" ExtAction="U">
<linesOfInsurance ExtAction="U">
<underlyingPolicy ExtAction="U">
<PolicyNo>44</PolicyNo>
<VersionNbr>2</VersionNbr>
<selectedInd>Y</selectedInd>
<deletedInd>N</deletedInd>
</underlyingPolicy>
<underlyingPolicy ID="5" ExtAction="U">
<PolicyNo>44</PolicyNo>
<VersionNbr>1</VersionNbr>
<selectedInd>N</selectedInd>
<deletedInd>Y</deletedInd>
</underlyingPolicy>
<underlyingPolicy ID="4" ExtAction="U">
<PolicyNo>33</PolicyNo>
<VersionNbr>2</VersionNbr>
<selectedInd>N</selectedInd>
<deletedInd>Y</deletedInd>
</underlyingPolicy>
<underlyingPolicy ID="3" ExtAction="U">
<PolicyNo>33</PolicyNo>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<deletedInd>N</deletedInd>
</underlyingPolicy>
</linesOfInsurance>
</policy>
</PWData>
</PWResponse>
</AdaptikXML>
测试用例 5 - 最终结果应该是策略 22 版本 1 已选择Ind = 'Y' 和已删除Ind = 'N'
,策略 11 版本 1 已选择Ind = 'N' AND 已删除Ind = 'Y'。策略 33 版本 1 和策略 44 版本 2 已选择Ind = 'Y' 并删除Ind = 'N'。策略 33 版本 2 和策略 44 版本 1 已选择Ind = 'N' 并删除Ind = 'Y'。
<policy VERSION_NO="1" MC_ID="89">
<businessGroupCdGvngOrgn>14</businessGroupCdGvngOrgn>
<linesOfInsurance>
<underlyingPolicy ID="10">
<PolicyNo>44</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>AL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="9">
<PolicyNo>44</PolicyNo>
<deletedInd>N</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>AL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="8">
<PolicyNo>33</PolicyNo>
<deletedInd>N</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>AL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="7">
<PolicyNo>33</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>AL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy>
<PolicyNo>22</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>N</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="5">
<PolicyNo>22</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="4">
<PolicyNo>11</PolicyNo>
<deletedInd>Y</deletedInd>
<VersionNbr>2</VersionNbr>
<selectedInd>N</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
<underlyingPolicy ID="3">
<PolicyNo>11</PolicyNo>
<deletedInd>N</deletedInd>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<CategoryCd>GL</CategoryCd>
</underlyingPolicy>
</linesOfInsurance>
</policy>
预期运营时间:
<AdaptikXML>
<PWResponse>
<ReturnCode>SUCCESS</ReturnCode>
<ReturnReasonCode>CHANGE</ReturnReasonCode>
<ReturnMessage/>
<PWData>
<policy VERSION_NO="1" MC_ID="89" ExtAction="U">
<linesOfInsurance ExtAction="U">
<underlyingPolicy ID="5" ExtAction="U">
<PolicyNo>22</PolicyNo>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<deletedInd>N</deletedInd>
</underlyingPolicy>
<underlyingPolicy ID="3" ExtAction="U">
<PolicyNo>11</PolicyNo>
<VersionNbr>1</VersionNbr>
<selectedInd>N</selectedInd>
<deletedInd>Y</deletedInd>
</underlyingPolicy>
<underlyingPolicy ID="10" ExtAction="U">
<PolicyNo>44</PolicyNo>
<VersionNbr>2</VersionNbr>
<selectedInd>Y</selectedInd>
<deletedInd>N</deletedInd>
</underlyingPolicy>
<underlyingPolicy ID="9" ExtAction="U">
<PolicyNo>44</PolicyNo>
<VersionNbr>1</VersionNbr>
<selectedInd>N</selectedInd>
<deletedInd>Y</deletedInd>
</underlyingPolicy>
<underlyingPolicy ID="8" ExtAction="U">
<PolicyNo>33</PolicyNo>
<VersionNbr>2</VersionNbr>
<selectedInd>N</selectedInd>
<deletedInd>Y</deletedInd>
</underlyingPolicy>
<underlyingPolicy ID="7" ExtAction="U">
<PolicyNo>33</PolicyNo>
<VersionNbr>1</VersionNbr>
<selectedInd>Y</selectedInd>
<deletedInd>N</deletedInd>
</underlyingPolicy>
</policy>
</PWData>
</PWResponse>
</AdaptikXML>
您的样式表看起来不仅仅是检查"MANYPOL"和"MANY",但我将只专注于手头的任务......
考虑使用键按相关指标查找underlyingPolicy
元素
<xsl:key name="policy"
match="underlyingPolicy"
use="concat(CategoryCd, '|', selectedInd, '|', deletedInd)" />
然后,您可以测试是否存在两个具有相同指标的不同策略编号,如下所示:
<xsl:when test="linesOfInsurance/underlyingPolicy
[PolicyNo != key('policy', concat(CategoryCd, '|', selectedInd, '|', deletedInd))/PolicyNo]">
这为您提供了MANYPOL
结果。
现在,您可能想通过将"不等于"更改为"等于"来检查MANY
<xsl:when test="linesOfInsurance/underlyingPolicy
[PolicyNo = key('policy', concat(CategoryCd, '|', selectedInd, '|', deletedInd))/PolicyNo]">
但这行不通,因为它会将当前的underlyingPolicy
元素与自身匹配!相反,请创建包含PolicyNo
<xsl:key name="policy_with_no"
match="underlyingPolicy"
use="concat(PolicyNo, '|', CategoryCd, '|', selectedInd, '|', deletedInd)" />
然后,您可以检查是否有多个相同数量的策略共享相同的指标,如下所示:
<xsl:when test="linesOfInsurance/underlyingPolicy
[key('policy_with_no', concat(PolicyNo, '|',CategoryCd, '|', selectedInd, '|', deletedInd))[2]]">
通过使用xsl:choose
,首先评估第一个xsl:when
,因此将始终输出 MANYPOL,即使MANY
也为真。
试试这个 XSLT
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
<xsl:output method="xml" indent="yes" />
<xsl:key name="policy" match="underlyingPolicy" use="concat(CategoryCd, '|', selectedInd, '|', deletedInd)" />
<xsl:key name="policy_with_no" match="underlyingPolicy" use="concat(PolicyNo, '|', CategoryCd, '|', selectedInd, '|', deletedInd)" />
<xsl:template match="/policy">
<PWResponse>
<xsl:choose>
<xsl:when test="linesOfInsurance/underlyingPolicy[PolicyNo != key('policy', concat(CategoryCd, '|', selectedInd, '|', deletedInd))/PolicyNo]">
<ReturnCode>FAILURE</ReturnCode>
<ReturnReasonCode>MANYPOL</ReturnReasonCode>
</xsl:when>
<xsl:when test="linesOfInsurance/underlyingPolicy[key('policy_with_no', concat(PolicyNo, '|',CategoryCd, '|', selectedInd, '|', deletedInd))[2]]">
<ReturnCode>FAILURE</ReturnCode>
<ReturnReasonCode>MANYPOL</ReturnReasonCode>
</xsl:when>
<xsl:otherwise>
<ReturnCode>SUCCESS</ReturnCode>
<ReturnReasonCode></ReturnReasonCode>
</xsl:otherwise>
</xsl:choose>
</PWResponse>
</xsl:template>
</xsl:stylesheet>