提问人:Chris Tucker 2016 提问时间:7/13/2022 最后编辑:Chris Tucker 2016 更新时间:7/13/2022 访问量:63
在 xslt 中获取地址输出时需要帮助
Need help in getting Address output in xslt
问:
我面临以下获取地址的问题,我的要求是根据 peci:Usage_Behavior_ID 分别获取当前地址和永久地址,但我无法就此获得任何帮助,非常感谢。
<?xml version='1.0' encoding='UTF-8'?>
<peci:Workers_Effective_Stack xmlns:peci="urn:com.workday/peci">
<peci:Summary>
<peci:Integration_Event>ca000e0bfc7d10056cba8e3f90580000</peci:Integration_Event>
<peci:Integration_Sent_On>2022-07-12T11:50:39.796-07:00</peci:Integration_Sent_On>
<peci:Payroll_Company_ID>CUSTOM_ORGANIZATION-6-121</peci:Payroll_Company_ID>
<peci:Payroll_Company_Name>India Payroll</peci:Payroll_Company_Name>
<peci:Payroll_Company_Code>INDPAY</peci:Payroll_Company_Code>
<peci:Pay_Group_ID>PG_India_Pay_Group</peci:Pay_Group_ID>
<peci:Pay_Group_Name>India Pay Group</peci:Pay_Group_Name>
<peci:Pay_Group_Country>IN</peci:Pay_Group_Country>
<peci:Pay_Group_Code/>
<peci:Pay_Period_Start>2022-07-01-07:00</peci:Pay_Period_Start>
<peci:Pay_Period_End>2022-07-31-07:00</peci:Pay_Period_End>
<peci:Updated_From>2022-07-11T05:40:07.000-07:00</peci:Updated_From>
<peci:Updated_To>2022-07-12T11:50:39.796-07:00</peci:Updated_To>
<peci:Effective_From>2022-07-01-07:00</peci:Effective_From>
<peci:Effective_To>2022-07-31-07:00</peci:Effective_To>
<peci:Change_Detection>Include only changes entered since the last successful
run.</peci:Change_Detection>
<peci:First_Primary_Run_of_Pay_Period>0</peci:First_Primary_Run_of_Pay_Period>
<peci:Ad_Hoc_Run>1</peci:Ad_Hoc_Run>
<peci:Full_Snapshot>0</peci:Full_Snapshot>
<peci:Worker_Count>1</peci:Worker_Count>
<peci:Version>1</peci:Version>
</peci:Summary>
<peci:Worker>
<peci:Worker_Summary>
<peci:WID>034e29aefd0e1012e7328dbe7bd30000</peci:WID>
<peci:Employee_ID>100879</peci:Employee_ID>
<peci:Name>Test India Employee</peci:Name>
</peci:Worker_Summary>
<peci:Effective_Change peci:Sequence="0">
<peci:Derived_Event_Code>DTA</peci:Derived_Event_Code>
<peci:Effective_Moment>2022-07-12T00:00:00.000-07:00</peci:Effective_Moment>
<peci:Entry_Moment>2022-07-12T11:49:35.683-07:00</peci:Entry_Moment>
<peci:Worker_Status>
<peci:Status>Active</peci:Status>
<peci:Active>1</peci:Active>
<peci:Active_Status_Date>2022-06-27-07:00</peci:Active_Status_Date>
<peci:Terminated>0</peci:Terminated>
<peci:Hire_Date>2022-06-27-07:00</peci:Hire_Date>
<peci:Original_Hire_Date>2022-06-27-07:00</peci:Original_Hire_Date>
</peci:Worker_Status>
<peci:Person_Communication peci:isUpdated="1">
<peci:Address>
<peci:Usage_Type>HOME</peci:Usage_Type>
<peci:Address_Line_1>Test 123</peci:Address_Line_1>
<peci:City>Bangalore</peci:City>
<peci:Postal_Code>125447</peci:Postal_Code>
<peci:Country>IN</peci:Country>
<peci:State_Province>Karnataka</peci:State_Province>
<peci:Usage>
<peci:Usage_Behavior_ID>Permanent</peci:Usage_Behavior_ID>
</peci:Usage>
</peci:Address>
<peci:Address peci:isAdded="1">
<peci:Usage_Type>HOME</peci:Usage_Type>
<peci:Address_Line_1>1334</peci:Address_Line_1>
<peci:Address_Line_2>vinay</peci:Address_Line_2>
<peci:City>chennai</peci:City>
<peci:Postal_Code>600045</peci:Postal_Code>
<peci:Country>IN</peci:Country>
<peci:State_Province>Tamil Nadu</peci:State_Province>
<peci:Usage>
<peci:Usage_Behavior_ID>Current</peci:Usage_Behavior_ID>
</peci:Usage>
</peci:Address>
</peci:Person_Communication>
</peci:Effective_Change>
</peci:Worker>
</peci:Workers_Effective_Stack>
在以下地址部分的场景中,如果 peci:Usage_Behavior_ID ='永久' 那么只有永久地址应该出现 输出应为
<Address_Line_1>Test 123</Address_Line_1>
<City>Bangalore</City>
<Postal_Code>125447</Postal_Code>
<Country>IN</Country>
<State_Province>Karnataka</State_Province>
如果 peci:Usage_Behavior_ID ='Current' 那么只有 Current 的地址应该出现
示例输出
<Address_Line_1>1334<Address_Line_1>
<Address_Line_2>vinay<Address_Line_2>
<City>chennai</City>
<Postal_Code>600045</Postal_Code>
<Country>IN</Country>
<State_Province>Tamil Nadu</State_Province>
我试过了,但地址重叠了。请提供解决方案
<xsl:choose>
<xsl:when test="peci:Person_Communication/peci:Address/peci:Usage/peci:Usage_Behavior_ID ='Current'">
<!--Current Flat/House/Wing Number - -->
<Current_Flat_House_Wing_Number xtt:quotes="always">
<xsl:value-of select="peci:Person_Communication/peci:Address[peci:Usage_Type='HOME']/peci:Address_Line_1"/>
</Current_Flat_House_Wing_Number>
<!--Current Street/Locality/Area - -->
<Current_Street_Locality_Area xtt:quotes="always">
<xsl:value-of select="peci:Person_Communication/peci:Address[peci:Usage_Type='HOME']/peci:Address_Line_1"/>
</Current_Street_Locality_Area>
<!--Current Landmark - -->
<Current_Landmark xtt:quotes="always">
<xsl:value-of select="peci:Person_Communication/peci:Address[peci:Usage_Type='HOME']/peci:Address_Line_1"/>
</Current_Landmark>
<!--Current Pincode - -->
<Current_Pincode xtt:quotes="always">
<xsl:value-of select="peci:Person_Communication/peci:Address[peci:Usage_Type='HOME']/peci:Postal_Code"/>
</Current_Pincode>
<!--Current Country - -->
<Current_Country xtt:quotes="always">
<xsl:value-of select="peci:Person_Communication/peci:Address[peci:Usage_Type='HOME']/peci:Country"/>
</Current_Country>
<!--Current State - -->
<Current_State xtt:quotes="always">
<xsl:value-of select="peci:Person_Communication/peci:Address[peci:Usage_Type='HOME']/peci:State_Province"/>
</Current_State>
<!--Current City - -->
<Current_City xtt:quotes="always">
<xsl:value-of select="peci:Person_Communication/peci:Address[peci:Usage_Type='HOME']/peci:City"/>
</Current_City>
</xsl:when>
</xsl:choose>
```
The output i got was repeating
答: 暂无答案
评论